XPath Functions
XPath functions can be used in the Expression builder to create complex calculation or constraints. These functions are broken up into several subsets of functions which are listed below.
Context Functions and Duration/Date/Time Functions
A list of Context Functions and Duration/Date/Time functions can be found in the User Guide section named Date Calculations Using the Expression Builder.
Numeric Functions
Function | Description | Example |
| abs | Returns the absolute value of a number. | abs(3.14) will return 3.14 and abs(-3.14) will return 3.14 |
| ceiling | Returns the smallest integer that is greater than the number. | ceiling(3.14) will return the integer 4 |
| floor | Returns the largest integer that is less than the number. | floor(3.14) will return the integer 3 |
| number | Returns the numeric value of the argument. The argument can be boolean, string (text), or node-set. | number('100') will convert a text input of 100 to the numeric value 100 |
| round | Rounds the number to the nearest integer. | round(3.14) will return the integer 3 |
| round-half-to-even | Rounds the number to the nearest even integer. | round-half-to-even(0.5) will return 0 and round-half-to-even(1.5) will return 2 |
Sequence Functions
Function | Description | Example |
| avg | Returns the average of a list of arguments. | avg(1,2,3) will return 2 |
| count | Returns the number of arguments in a list. | count('a','b','c','d') will return 4 |
| max | Returns the greatest argument from a list. | max(1,2,3) will return 3 and max('a','b','c') will return c |
| min | Returns the smallest argument from a list. | min(1,2,3) will return 1 and min('a','b','c') will return a |
| sum | Returns the numeric sum of a list of numbers or nodes from a node-set. | sum(1,2,3) will return 6 |
String Functions
Function | Description | Example |
| compare | Returns -1 if argument 1 is less than argument 2, 0 if argument 1 equals argument 2 or 1 if argument 1 is greater than argument 2 | compare(1,2) will return -1, compare(2,2) will return 0, compare(3,2) will return 1 |
| concat | Combines a list of arguments into a single string (text). | concat('Coghead ','is ','FUN!') will return 'Coghead is FUN!' |
| contains | Returns true if string1 contains string 2 or returns false if string1 does not contain string2. | contains('Coghead','Cog') will return true, contains('Coghead','Coglet') will return false |
| lower-case | Converts the string to all lower case letters. | lower-case('COGHEAD') will return 'coghead' |
| matches | Returns true if argument 1 matches the pattern of argument 2 or returns false if argument 1 does not match the pattern of argument 2. | matches('Coghead','Cog') will return true |
| replace | Returns a string (text) that replaces all the occurrences of argument 2 with the value in argument 3 in argument 1. | replace('Application','p','^') will return 'A^^lication' |
| string-join | Combines a list of string (text) arguments into a single string (text). | string-join('Coghead ','is ','FUN!') will return 'Coghead is FUN!' |
| string-length | Returns a numeric value of the length of a string. | string-length('Coghead') will return the number 7 |
| substring | Returns a specified length of an argument from a specified start point. | substring('Coghead',4,4) will return 'head', substring('Coghead',1,3) will return 'Cog' |
| substring-after | Returns the remaining length of an argument after argument 2 occurs in the string. | substring('Coghead','e') will return 'ad' |
| substring-before | Returns the beginning of an argument before argument 2 occurs in the string. | substring('Coghead','h') will return 'Cog' |
| upper-case | Converts the text string argument to capital letters. | upper-case('coghead') will return 'COGHEAD' |