Functions
In the Function Usage section
above, we describe how and why to use a function in RecordPath. Here, we
will describe the different functions that are available, what they do, and
how they work. Functions can be divided into two groups: Standalone Functions, which can be the 'root' of a RecordPath, such as substringAfter(
/name, ' ' )
and Filter Functions,
which are to be used as a filter, such as /name[ contains('John')
]
. A Standalone Function can also be used within a filter
but does not return a boolean
(true
or
false
value) and therefore cannot itself be an
entire filter. For example, we can use a path such as /name[
substringAfter(., ' ') = 'Doe']
but we cannot simply use
/name[ substringAfter(., ' ') ]
because doing so
doesn't really make sense, as filters must be boolean values.
Unless otherwise noted, all of the examples below are written to operate on the following Record:
{
"name": "John Doe",
"workAddress": {
"number": "123",
"street": "5th Avenue",
"city": "New York",
"state": "NY",
"zip": "10020"
},
"homeAddress": {
"number": "456",
"street": "Grand St",
"city": "Jersey City",
"state": "NJ",
"zip": "07304"
},
"details": {
"position": "Dataflow Engineer",
"preferredState": "NY",
"employer": "",
"vehicle": null,
"phrase": " "
}
}