Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,28 @@ The `contains()` function tests whether a string attribute contains a specific s
String comparisons in XPath constraints are generally case-insensitive, but this can depend on the collation setting for some databases. See [Case-Sensitive Database Behavior](/refguide/case-sensitive-database-behavior/) for more information.
{{% /alert %}}

## Syntax

The syntax is as follows:

```
contains ( attribute, string_expression )
```

### attribute

`attribute` specifies the attribute to test in. Attribute must be of the **String** type.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't have to be a simple attribute, it can also be a long path ending at an attribute.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about mentioning that, but the entire xpath constraint documentation never explicitly mentions paths and always refers to attributes. I don't know if this distinction is necessary to highlight.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave this for @MarkvanMents to consider.


### expression

`string_expression` specifies the value to test for being contained in the attribute. It can be a string literal or a string parameter.

{{% alert color="info" %}}
In the case the `attribute` is an empty value or `NULL`, the function will always return `false`, independent of the value of `string_expression`.

In the case the `string_expression` is empty, it is treated as an empty string. The function is then equivalent to ```attribute != empty```.
{{% /alert %}}

## Example

This query returns all the customers from which the name contains the string `an`:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,28 @@ The `ends-with()` function checks whether a string attribute ends with a specifi
String comparisons in XPath constraints are generally case-insensitive, but this can depend on the collation setting for some databases. See [Case-Sensitive Database Behavior](/refguide/case-sensitive-database-behavior/) for more information.
{{% /alert %}}

## Syntax

The syntax is as follows:

```
ends-with ( attribute, string_expression )
```

### attribute

`attribute` specifies the attribute to test in. Attribute must be of the **String** type.

### expression

`string_expression` specifies the value to test for being at the end of the attribute. It should be a string literal or a string parameter.

{{% alert color="info" %}}
In the case the `attribute` is an empty value or `NULL`, the function will always return `false`, independent of the value of `string_expression`.

In the case the `string_expression` is empty, it is treated as an empty string. The function is then equivalent to ```attribute != empty```.
{{% /alert %}}

## Example

This query returns all customers whose name ends with the sub-string `sen`:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,28 @@ The `starts-with()` function tests whether a string attribute starts with a spec
String comparisons in XPath constraints are generally case-insensitive, but this can depend on the collation setting for some databases. See [Case-Sensitive Database Behavior](/refguide/case-sensitive-database-behavior/) for more information.
{{% /alert %}}

## Syntax

The syntax is as follows:

```
starts-with ( attribute, string_expression )
```

### attribute

`attribute` specifies the attribute to test in. Attribute must be of the **String** type.

### expression

`string_expression` specifies the value to test for being at the start of the attribute. It should be a string literal or a string parameter.

{{% alert color="info" %}}
In the case the `attribute` is an empty value or `NULL`, the function will always return `false`, independent of the value of `string_expression`.

In the case the `string_expression` is empty, it is treated as an empty string. The function is then equivalent to ```attribute != empty```.
{{% /alert %}}

## Example

This query returns all the customers from which the name starts with the string "Jans":
Expand Down