Skip to content

Commit 1ac875d

Browse files
committed
Clarify handling of empty arguments in xpath functions contains, starts-with and ends-with
1 parent 7eda702 commit 1ac875d

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

content/en/docs/refguide/modeling/xpath/xpath-constraints/xpath-constraint-functions/xpath-contains.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,28 @@ The `contains()` function tests whether a string attribute contains a specific s
1313
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.
1414
{{% /alert %}}
1515

16+
## Syntax
17+
18+
The syntax is as follows:
19+
20+
```
21+
contains ( attribute, string_expression )
22+
```
23+
24+
### attribute
25+
26+
`attribute` specifies the attribute to test in. Attribute must be of the **String** type.
27+
28+
### expression
29+
30+
`string_expression` specifies the value to test for being contained in the attribute. It can be a string literal or a string parameter.
31+
32+
{{% alert color="info" %}}
33+
In the case the `attribute` is an empty value or `NULL`, the function will always return `false`, independent of the value of `string_expression`.
34+
35+
In the case the `string_expression` is empty, it is treated as an empty string. The function is then equivalent to ```attribute != empty```.
36+
{{% /alert %}}
37+
1638
## Example
1739

1840
This query returns all the customers from which the name contains the string `an`:

content/en/docs/refguide/modeling/xpath/xpath-constraints/xpath-constraint-functions/xpath-ends-with.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,28 @@ The `ends-with()` function checks whether a string attribute ends with a specifi
1313
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.
1414
{{% /alert %}}
1515

16+
## Syntax
17+
18+
The syntax is as follows:
19+
20+
```
21+
ends-with ( attribute, string_expression )
22+
```
23+
24+
### attribute
25+
26+
`attribute` specifies the attribute to test in. Attribute must be of the **String** type.
27+
28+
### expression
29+
30+
`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.
31+
32+
{{% alert color="info" %}}
33+
In the case the `attribute` is an empty value or `NULL`, the function will always return `false`, independent of the value of `string_expression`.
34+
35+
In the case the `string_expression` is empty, it is treated as an empty string. The function is then equivalent to ```attribute != empty```.
36+
{{% /alert %}}
37+
1638
## Example
1739

1840
This query returns all customers whose name ends with the sub-string `sen`:

content/en/docs/refguide/modeling/xpath/xpath-constraints/xpath-constraint-functions/xpath-starts-with.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,28 @@ The `starts-with()` function tests whether a string attribute starts with a spec
1313
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.
1414
{{% /alert %}}
1515

16+
## Syntax
17+
18+
The syntax is as follows:
19+
20+
```
21+
starts-with ( attribute, string_expression )
22+
```
23+
24+
### attribute
25+
26+
`attribute` specifies the attribute to test in. Attribute must be of the **String** type.
27+
28+
### expression
29+
30+
`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.
31+
32+
{{% alert color="info" %}}
33+
In the case the `attribute` is an empty value or `NULL`, the function will always return `false`, independent of the value of `string_expression`.
34+
35+
In the case the `string_expression` is empty, it is treated as an empty string. The function is then equivalent to ```attribute != empty```.
36+
{{% /alert %}}
37+
1638
## Example
1739

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

0 commit comments

Comments
 (0)