ELEMENT
The ELEMENT function returns a single element from a string of delimiter separated elements.
Function Name |
ELEMENT |
Description |
Returns a single element from a string of delimiter separated elements. |
Arguments |
ELEMENT(ELEMENT NUMBER, 'DELIMITER', 'STRING', DIRECTION) Where:
|
Returns |
STRING The function returns the specified single element from the list of delimiter separated elements. |
Example:
An expression to return the first element of a comma delimited string:
ELEMENT( 1, ',', 'Good,Bad,Failed', 0 )
The 1 indicates that the first element is to be extracted from the left direction (0) of the comma delimited string in which the string elements are separated by a comma (','). This results in the expression returning the string Good
.
To return the last element from the same comma delimited string, you would change the last argument from a 0 to a 1 (to denote that the required string is to be extracted from the right side of the comma delimited string):
ELEMENT( 1, ',', 'Good,Bad,Failed', 1 )
This expression returns the string Failed
.