Adaptive expressions prebuilt functions

APPLIES TO: yesSDK v4 no SDK v3

This article lists the available prebuilt functions ordered by their general purpose. Prebuilt expressions are divided into the following function types:

You can also view the list in alphabetical order.

String functions

Function Explanation
length Return the length of a string.
replace Replace a substring with the specified string and return the updated string. This function is case-sensitive.
replaceIgnoreCase Replace a substring with the specified string, and return the updated string. This function is case-insensitive.
split Return an array that contains substrings based on the delimiter specified.
substring Return characters from a string. substring(sourceString, startPos, endPos). startPos cannot be less than 0. endPos greater than the length of the source string will be taken as the max length of the string.
toLower Convert a string to all lowercase characters.
toUpper Convert a string to all uppercase characters.
trim Remove leading and trailing white spaces from a string.
addOrdinal Return the ordinal number of the input number.
endsWith Check whether a string ends with a specific substring. Return true if the substring is found, or return false if not found. This function is case-insensitive.
startsWith Check whether a string starts with a specific substring. Return true if the substring is found, or return false if not found. This function is case-insensitive.
countWord Return the number of words in the given string.
concat Combine two or more strings and return the resulting string.
newGuid Return a new Guid string.
indexOf Return the starting position or index value of a substring or searches for the specified object and return the zero-based index of the first occurrence within the entire list. This function is case-insensitive, and indexes start with the number 0.
lastIndexOf Return the starting position or index value of the last occurrence of a substring or search for the specified object and return the zero-based index of the last occurrence within the range of elements in the list.This function is case-insensitive, and indexes start with the number 0.

Collection functions

Function Explanation
contains Works to find an item in a string, to find an item in an array, or to find a parameter in a complex object.
Examples:
contains('hello world', 'hello')
contains(createArray('1','2'), '1')
contains(json("{'foo':'bar'}"), 'foo')
first Return the first item from the collection.
join Return a string that has all the items from an array and has each character separated by a delimiter. join(collection, delimiter).
Example:
join(createArray('a','b'), '.') = "a.b"
last Return the last item from the collection.
count Return the number of items in the collection.
foreach Operate on each element and return the new collection.
union Return a collection that has all the items from the specified collections.
skip Remove items from the front of a collection, and return the remaining items.
take Return items from the front of a collection.
intersection Return a collection that has only the common items across the specified collections.
subArray Return a subarray from specified start and end position. Index values start with the number 0.
select Operate on each element and return the new collection of transformed elements.
where Filter on each element and return the new collection of filtered elements which match the specific condition.
sortBy Sort elements in the collection in ascending order and return the sorted collection.
sortByDescending Sort elements in the collection in descending order and return the sorted collection.
indicesAndValues Turn an array or object into an array of objects with index and value property.
flatten Flatten arrays into an array with non-array values.
unique Remove all duplicates from an array.

Logical comparison functions

Function Explanation
and Logical and. Return true if all specified expressions evaluate to true.
equals Comparison equal. Return true if specified values are equal.
empty Check if the target is empty.
greater Comparison greater than. Return true if the first value is more, or return false if less.
greaterOrEquals Comparison greater than or equal to. Return true if the first value is greater or equal, or return false if the first value is less.
if Check whether an expression is true or false. Based on the result, return a specified value.
less Comparison less than opearation. Return true if the first value is less, or return false if the first value is more.
lessOrEquals Comparison less than or equal operation. Return true if the first value is less than or equal, or return false if the first value is more.
not Logical not opearator. Return true if the expression is false, or return false if true.
or Logical or opearation. Return true if at least one expression is true, or return false if all are false.
exists Evaluate an expression for truthiness.

Conversion functions

Function Explanation
float Return the floating point representation of the specified string or the string itself if conversion isn't possible.
int Return the integer representation of the specified string or the string itself if conversion isn't possible.
string Return the string version of the specified value.
bool Return the Boolean representation of the specified string.
createArray Create an array from multiple inputs.
json Return the JavaScript Object Notation (JSON) type value or object of a string or XML.
base64 Return the base64-encoded version of a string or byte array.
base64ToBinary Return the binary version for a base64-encoded string.
base64ToString Return the string version of a base64-encoded string.
binary Return the binary version for an input value.
dataUri Return the URI for an input value.
dataUriToBinary Return the binary version of a data URI.
dataUriToString Return the string version of a data URI.
uriComponent Return the URI-encoded version for an input value by replacing URL-unsafe characters with escape characters.
uriComponentToString Return the string version of a URI-encoded string.
xml C# only. Return the XML version of a string.

Math functions

Function Explanation
add Mathematical and. Return the result from adding two numbers (pure number case) or concatting two or more strings.
div Mathematical division. Return the integer result from dividing two numbers.
max Return the largest value from a collection.
min Return the smallest value from a collection.
mod Return the remainder from dividing two numbers.
mul Mathematical multiplication. Return the product from multiplying two numbers.
rand Return a random number between specified min and max value.
sub Mathematical subtraction. Return the result from subtracting the second number from the first number.
sum Return the sum of numbers in an array.
range Return an integer array that starts from a specified integer.
exp Return exponentiation of one number to another.
average Return the average number of an numeric array.

Date and time functions

Function Explanation
addDays Add a number of specified days to a given timestamp.
addHours Add a specified number of hours to a given timestamp.
addMinutes Add a specified number of minutes to a given timestamp.
addSeconds Add a specified number of seconds to a given timestamp.
dayOfMonth Return the day of a month for a given timestamp or Timex expression.
dayOfWeek Return the day of the week for a given timestamp.
dayOfYear Return the day of the year for a given timestamp.
formatDateTime Return a timestamp in the specified format.
formatEpoch Return a timestamp from UNIX Epoch time (Unix time, POSIX time).
formatTicks Return a timestamp from ticks.
subtractFromTime Subtract a number of time units from a timestamp.
utcNow Return the current timestamp as string.
dateReadBack Use the date-time library to provide a date readback.
month Return the month of given timestamp.
date Return the date for a given timestamp.
year Return the year for the given timestamp.
getTimeOfDay Return the time of day for a given timestamp.
getFutureTime Return the current timestamp plus the specified time units.
getPastTime Return the current timestamp minus the specified time units.
addToTime Add a number of time units to a timestamp.
convertFromUTC Convert a timestamp from Universal Time Coordinated(UTC).
convertToUTC Convert a timestamp to Universal Time Coordinated (UTC).
startOfDay Return the start of the day for a timestamp.
startOfHour Return the start of the hour for a timestamp.
startOfMonth Return the start of the month for a timestamp.
ticks Return the ticks property value of a specified timestamp.

Timex functions

Function Explanation
isPresent Return true if the TimexProperty or Timex expression refers to the present.
isDuration Return true if the TimexProperty or Timex expression refers to a duration.
isTime Return true if the TimexProperty or Timex expression refers to a time.
isDate Return true if the TimexProperty or Timex expression refers to a date.
isTimeRange Return true if the TimexProperty or Timex expression refers to a time range.
isDateRange Return true if the TimexProperty or Timex expression refers to a date range.
isDefinite Return true if the TimexProperty or Timex expression refers to a definite day.

URI parsing functions

Function Explanation
uriHost Return the host value of a uniform resource identifier (URI).
uriPath Return the path value of a unifor resource identifier (URI).
uriPathAndQuery Return the path and query values for a uniform resource identifier (URI).
uriPort Return the port value of a uniform resource identifier (URI).
uriQuery Retur0sn the query value of a uniform resouce identifier (URI).
uriScheme Return the scheme value of a uniform resource identifier (URI).

Object manipulation and construction functions

Function Explanation
addProperty Add a property and its value, or name-value pair, to a JSON object and return the updated object.
removeProperty Remove a property from JSON object and return the updated object.
setProperty Set the value of a JSON object's property and return the updated object.
getProperty Return the value of the given property in a JSON object.
coalesce Return the first non-null value from one or more parameters.
xPath C# only. Check XML for nodes or values that match an XPath (XML Path Language) expression, and return the matching nodes or values.
jPath Check JSON or a JSON string for nodes or value that match a path expression, and return the matching nodes.
setPathToValue Set the value of a specific path and return the value.

Regular expression functions

Function Explanation
isMatch Return true if a string matches a common regex pattern.

Type checking functions

Function Explanation
isInteger Return true if given input is an integer number
isFloat Return true if the given input is a float point number
isBoolean Return true if the given input is a Boolean.
isArray Return true if the given input is an array.
isObject Return true if the given input is an object.
isDateTime Return true if the given input is a UTC ISO format timestamp.
isString Return true if the given input is a string.

add

Return the result from adding two or more numbers (pure number case) or concatting two or more strings (other case).

add(<item1>, <item2>, ...)
Parameter Required Type Description
<item1>, <item2>,... Yes any items
Return value Type Description
<result-sum> number or string The result from adding the specified numbers or the concat result.

Example

This example adds the specified numbers:

add(1, 1.5)

And returns the result 2.5.

This example concats the specified items:

add('hello',null)
add('hello','world')

And returns the results

  • hello
  • helloworld

addDays

Add a number of days to a timestamp.

addDays('<timestamp>', <days>, '<format>'?)
Parameter Required Type Description
<timestamp> Yes string The string that contains the timestamp which must be standard UTC ISO format
YYYY-MM-DDTHH:mm:ss.fffZ
<days> Yes integer The positive or negative number of days to add
<format> No string A custom format pattern. The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
Return value Type Description
<updated-timestamp> string The timestamp plus the specified number of days

Example 1

This example adds 10 days to the specified timestamp:

addDays('2018-03-15T13:00:00.000Z', 10)

And returns the result 2018-03-25T00:00:00.000Z.

Example 2

This example subtracts five days from the specified timestamp:

addDays('2018-03-15T00:00:00.000Z', -5)

And returns the result 2018-03-10T00:00:00.000Z.

addHours

Add a number of hours to a timestamp.

addHours('<timestamp>', <hours>, '<format>'?)
Parameter Required Type Description
<timestamp> Yes string The string that contains the timestamp
<hours> Yes integer The positive or negative number of hours to add
<format> No string A custom format pattern. The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
Return value Type Description
<updated-timestamp> string The timestamp plus the specified number of hours

Example 1

This example adds 10 hours to the specified timestamp:

addHours('2018-03-15T00:00:00.000Z', 10)

And returns the result 2018-03-15T10:00:00.000Z.

Example 2

This example subtracts five hours from the specified timestamp:

addHours('2018-03-15T15:00:00.000Z', -5)

And returns the result 2018-03-15T10:00:00.000Z.

addMinutes

Add a number of minutes to a timestamp.

addMinutes('<timestamp>', <minutes>, '<format>'?)
Parameter Required Type Description
<timestamp> Yes string The string that contains the timestamp
<minutes> Yes integer The positive or negative number of minutes to add
<format> No string A custom format pattern. The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
Return value Type Description
<updated-timestamp> string The timestamp plus the specified number of minutes

Example 1

This example adds 10 minutes to the specified timestamp:

addMinutes('2018-03-15T00:10:00.000Z', 10)

And returns the result 2018-03-15T00:20:00.000Z.

Example 2

This example subtracts five minutes from the specified timestamp:

addMinutes('2018-03-15T00:20:00.000Z', -5)

And returns the result 2018-03-15T00:15:00.000Z.

addOrdinal

Return the ordinal number of the input number.

addOrdinal(<number>)
Parameter Required Type Description
<number> Yes integer The numbers to convert to an ordinal number
Return value Type Description
<result> string The ordinal number converted from the input number

Example

addOrdinal(11)
addOrdinal(12)
addOrdinal(13)
addOrdinal(21)
addOrdinal(22)
addOrdinal(23)

And respectively returns these results:

  • 11th
  • 12th
  • 13th
  • 21st
  • 22nd
  • 23rd

addProperty

Add a property and its value, or name-value pair, to a JSON object, and return the updated object. If the object already exists at runtime the function throws an error.

addProperty('<object>', '<property>', value)
Parameter Required Type Description
<object> Yes object The JSON object where you want to add a property
<property> Yes string The name of the property to add
<value> Yes any The value of the property
Return value Type Description
<updated-object> object The updated JSON object after adding a new property

Example
This example adds the accountNumber property to the customerProfile object, which is converted to JSON with the json() function. The function assigns a value that is generated by the newGuid() function, and returns the updated object:

addProperty(json('customerProfile'), 'accountNumber', newGuid())

addSeconds

Add a number of seconds to a timestamp.

addSeconds('<timestamp>', <seconds>, '<format>'?)
Parameter Required Type Description
<timestamp> Yes string The string that contains the timestamp
<seconds> Yes integer The positive or negative number of seconds to add
<format> No string A custom format pattern. The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
Return value Type Description
<updated-timestamp> string The timestamp plus the specified number of seconds

Example 1

This example adds 10 seconds to the specified timestamp:

addSeconds('2018-03-15T00:00:00.000Z', 10)

And returns the result 2018-03-15T00:00:10.000Z.

Example 2

This example subtracts five seconds to the specified timestamp:

addSeconds('2018-03-15T00:00:30.000Z', -5)

And returns the result 2018-03-15T00:00:25.000Z.

addToTime

Add a number of time units to a timestamp. See also getFutureTime().

addToTime('<timestamp>', '<interval>', <timeUnit>, '<format>'?)
Parameter Required Type Description
<timestamp> Yes string The string that contains the timestamp
<interval> Yes integer The number of specified time units to add
<timeUnit> Yes string The unit of time to use with interval. Possible units are "Second", "Minute", "Hour", "Day", "Week", "Month", and "Year".
<format> No string A custom format pattern. The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
Return value Type Description
<updated-timestamp> string The timestamp plus the number of specified time units with given format.

Example 1
This example adds one day to specified timestamp.

addToTime('2018-01-01T00:00:00.000Z', 1, 'Day')

And returns the result 2018-01-02T00:00:00.000Z.

Example 2
This example adds two weeks to the specified timestamp.

addToTime('2018-01-01T00:00:00.000Z', 2, 'Week', 'MM-DD-YY')

And returns the result in the 'MM-DD-YY' format as 01-15-18.

and

Check whether all expressions are true. Return true if all expressions are true, or return false if at least one expression is false.

and(<expression1>, <expression2>, ...)
Parameter Required Type Description
<expression1>, <expression2>, ... Yes Boolean The expressions to check
Return value Type Description
true or false Boolean Return true if all expressions are true. Return false if at least one expression is false.

Example 1

These examples check whether the specified Boolean values are all true:

and(true, true)
and(false, true)
and(false, false)

And respectively returns these results:

  • Both expressions are true, so the functions returns true.
  • One expression is false, so the functions returns false.
  • Both expressions are false, so the function returns false.

Example 2

These examples check whether the specified expressions are all true:

and(equals(1, 1), equals(2, 2))
and(equals(1, 1), equals(1, 2))
and(equals(1, 2), equals(1, 3))

And respectively returns these results:

  • Both expressions are true, so the functions returns true.
  • One expression is false, so the functions returns false.
  • Both expressions are false, so the functions returns false.

average

Return the number average of a numeric array.

average(<numericArray>)
Parameter Required Type Description
<numericArray> Yes array of number The input array to calculate the average
Return value Type Description
<average-of-array> number The average value of the given array

Example

This example calculates the average of the array in createArray():

average(createArray(1,2,3))

And returns the result 2.

base64

Return the base64-encoded version of a string or byte array.

base64('<value>')
Parameter Required Type Description
<value> Yes string or byte array The input string
Return value Type Description
<base64-string> string The base64-encoded version of the input string

Example 1

This example converts the string hello to a base64-encoded string:

base64('hello')

And returns the result "aGVsbG8=".

Example 2

This examples takes byteArr, which equals new byte[] { 3, 5, 1, 12 }:

base64('byteArr')

And returns the result "AwUBDA==".

base64ToBinary

Return the binary array of a base64-encoded string.

base64ToBinary('<value>')
Parameter Required Type Description
<value> Yes string The base64-encoded string to convert
Return value Type Description
<binary-for-base64-string> byte array The binary version of the base64-encoded string

Example

This example converts the base64-encoded string AwUBDA== to a binary string:

base64ToBinary('AwUBDA==')

And returns the result new byte[] { 3, 5, 1, 12 }.

base64ToString

Return the string version of a base64-encoded string, effectively decoding the base64 string.

base64ToString('<value>')
Parameter Required Type Description
<value> Yes string The base64-encoded string to decode
Return value Type Description
<decoded-base64-string> string The string version of a base64-encoded string

Example

This example converts the base64-encoded string aGVsbG8= to a decoded string:

base64ToString('aGVsbG8=')

And returns the result hello.

binary

Return the binary version of a string.

binary('<value>')
Parameter Required Type Description
<value> Yes string The string to convert
Return value Type Description
<binary-for-input-value> byte array The binary version of the specified string

Example

This example converts the string hello to a binary string:

binary('hello')

And returns the result new byte[] { 104, 101, 108, 108, 111 }.

bool

Return the Boolean version of a value.

bool(<value>)
Parameter Required Type Description
<value> Yes any The value to convert
Return value Type Description
true or false Boolean The Boolean version of the specified value

Example

These examples convert the specified values to Boolean values:

bool(1)
bool(0)

And respectively returns these results:

  • true
  • false

coalesce

Return the first non-null value from one or more parameters. Empty strings, empty arrays, and empty objects are not null.

coalesce(<object**1>, <object**2>, ...)
Parameter Required Type Description
<object**1>, <object**2>, ... Yes any (mixed types acceptable) One or more items to check for null
Return value Type Description
<first-non-null-item> any The first item or value that is not null. If all parameters are null, this function returns null.

Example
These examples return the first non-null value from the specified values, or null when all the values are null.

Here are some examples:

coalesce(null, true, false)
coalesce(null, 'hello', 'world')
coalesce(null, null, null)

They respectively return these results:

  • true
  • hello
  • null

concat

Combine two or more strings, and return the combined string.

concat('<text1>', '<text2>', ...)
Parameter Required Type Description
<text1>, <text2>, ... Yes string At least two strings to combine
Return value Type Description
<text1text2...> string The string created from the combined input strings

Example

This example combines the strings Hello and World:

concat('Hello', 'World')

And returns the result HelloWorld.

contains

Check whether a collection has a specific item. Return true if the item is found, or return false if not found. This function is case-sensitive.

contains('<collection>', '<value>')
contains([<collection>], '<value>')

This function works on the following collection types:

  • A string to find a substring
  • An array to find a value
  • A dictionary to find a key
Parameter Required Type Description
<collection> Yes string, array, or dictionary The collection to check
<value> Yes string, array, or dictionary, respectively The item to find
Return value Type Description
true or false Boolean Return true if the item is found. Return false if not found.

Example 1

This example checks the string hello world for the substring world:

contains('hello world', 'world')

And returns the result true.

Example 2

This example checks the string hello world for the substring universe:

contains('hello world', 'universe')

And returns the result false.

count

Return the number of items in a collection.

count('<collection>')
count([<collection>])
Parameter Required Type Description
<collection> Yes string or array The collection with the items to count
Return value Type Description
<length-or-count> integer The number of items in the collection

Examples:

These examples count the number of items in these collections:

count('abcd')
count(createArray(0, 1, 2, 3))

And both return the result 4.

countWord

Return the number of words in a string

countWord('<text>')
Parameter Required Type Description
<text> Yes string The string to count
Return value Type Description
<count> integer The number of words in the string

Example

This example counts the number of words in the string hello world:

countWord("hello word")

And it returns the result 2.

convertFromUTC

Convert a timestamp from Universal Time Coordinated (UTC) to a target time zone.

convertFromUTC('<timestamp>', '<destinationTimeZone>', '<format>'?)
Parameter Required Type Description
<timestamp> Yes string The string that contains the timestamp
<destinationTimeZone> Yes string The name of the target time zone. Supports Windows and Iana time zones.
<format> No string A custom format pattern. The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
Return value Type Description
<converted-timestamp> string The timestamp converted to the target time zone

Examples:

These examples convert from UTC to Pacific Standard Time:

convertFromUTC("convertFromUTC('2018-02-02T02:00:00.000Z', 'Pacific Standard Time', 'MM-DD-YY')"
convertFromUTC('2018-02-02T02:00:00.000Z', 'Pacific Standard Time')

And respectively return these results:

  • 02-01-18
  • 2018-02-01T18:00:00.000-08:00

convertToUTC

Convert a timestamp to Universal Time Coordinated (UTC) from the source time zone.

convertToUTC('<timestamp>', '<sourceTimeZone>', '<format>'?)
Parameter Required Type Description
<timestamp> Yes string The string that contains the timestamp
<sourceTimeZone> Yes string The name of the target time zone. Supports Windows and Iana time zones.
<format> No string A custom format pattern. The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
Return value Type Description
<converted-timestamp> string The timestamp converted to the target time zone

Example

convertToUTC('01/01/2018 00:00:00',', 'Pacific Standard Time')

Returns the result 2018-01-01T08:00:00.000Z.

createArray

Return an array from multiple inputs.

createArray('<object1>', '<object2>', ...)
Parameter Required Type Description
<object1>, <object2>, ... Yes any, but not mixed At least two items to create the array
Return value Type Description
[<object1>, <object2>, ...] array The array created from all the input items

Example

This example creates an array from the following inputs:

createArray('h', 'e', 'l', 'l', 'o')

And returns the result [h ,e, l, l, o].

dataUri

Return a data uniform resource identifier (URI) of a string.

dataUri('<value>')
Parameter Required Type Description
<value> Yes string The string to convert
Return value Type Description
[<date-uri>] string The data URI for the input string

Example

dataUri('hello')

Returns the result data:text/plain;charset=utf-8;base64,aGVsbG8=.

dataUriToBinary

Return the binary version of a data uniform resource identifier (URI).

dataUriToBinary('<value>')
Parameter Required Type Description
<value> Yes string The data URI to convert
Return value Type Description
[<binary-for-data-uri>] byte array The binary version of the data URI

Example

This example creates a binary version for the following data URI:

dataUriToBinary('aGVsbG8=')

And returns the result new byte[] { 97, 71, 86, 115, 98, 71, 56, 61 }.

dataUriToString

Return the string version of a data uniform resource identifier (URI).

dataUriToString('<value>')
Parameter Required Type Description
<value> Yes string The data URI to convert
Return value Type Description
[<string-for-data-uri>] string The string version of the data URI

Example

This example creates a string from the following data URI:

dataUriToString('data:text/plain;charset=utf-8;base64,aGVsbG8=')

And returns the result hello.

date

Return the date of a specified timestamp in m/dd/yyyy format.

date('<timestramp>')
Parameter Required Type Description
<timestamp> Yes string The string that contains the timestamp
Return value Type Description
<date> string The date of the specified timestamp
date('2018-03-15T13:00:00.000Z')

Returns the result 3-15-2018.

dateReadBack

Uses the date-time library to provide a date readback.

dateReadBack('<currentDate>', '<targetDate>')
Parameter Required Type Description
<currentDate> Yes string The string that contains the current date
<targetDate> Yes string The string that contains the target date
Return value Type Description
<date-readback> string The readback between current date and the target date

Example 1

dateReadBack('2018-03-15T13:00:00.000Z', '2018-03-16T13:00:00.000Z')

Returns the result tomorrow.

dayOfMonth

Return the day of the month from a timestamp.

dayOfMonth('<timestamp>')
Parameter Required Type Description
<timestamp> Yes string The string that contains the timestamp
Return value Type Description
<day-of-month> integer The day of the month from the specified timestamp

Example

This example returns the number for the day of the month from the following timestamp:

dayOfMonth('2018-03-15T13:27:36Z')

And returns the result 15.

dayOfWeek

Return the day of the week from a timestamp.

dayOfWeek('<timestamp>')
Parameter Required Type Description
<timestamp> Yes string The string that contains the timestamp
Return value Type Description
<day-of-week> integer The day of the week from the specified timestamp. Sunday is 0, Monday is 1, and so forth.

Example

This example returns the number for the day of the week from the following timestamp:

dayOfWeek('2018-03-15T13:27:36Z')

And returns the result 3.

dayOfYear

Return the day of the year from a timestamp.

dayOfYear('<timestamp>')
Parameter Required Type Description
<timestamp> Yes string The string that contains the timestamp
Return value Type Description
<day-of-year> integer The day of the year from the specified timestamp

Example

This example returns the number of the day of the year from the following timestamp:

dayOfYear('2018-03-15T13:27:36Z')

And returns the result 74.

div

Return the integer result from dividing two numbers. To return the remainder see mod().

div(<dividend>, <divisor>)
Parameter Required Type Description
<dividend> Yes number The number to divide by the divisor
<divisor> Yes number The number that divides the dividend. Cannot be 0.
Return value Type Description
<quotient-result> number The result from dividing the first number by the second number

Example

Both examples divide the first number by the second number:

div(10, 5)
div(11, 5)

And return the result 2.

If one of the parameters is a float, the result will be also be a float.

Example

div(11.2, 3)

Returns the result 5.5.

empty

Check whether an instance is empty. Return true if the input is empty. Empty means:

  • input is null or undefined
  • input is a null or empty string
  • input is zero size collection
  • input is an object with no property.
empty('<instance>')
empty([<instance>])
Parameter Required Type Description
<instance> Yes any The instance to check
Return value Type Description
true or false Boolean Return true when the instance is empty.

Example

These examples check whether the specified instance is empty:

empty('')
empty('abc')
empty([1])
empty(null)

And return these results respectively:

  • Passes an empty string, so the function returns true.
  • Passes the string abc, so the function returns false.
  • Passes the collection with one item, so the function returns false.
  • Passes the null object, so the function returns true.

endsWith

Check whether a string ends with a specific substring. Return true if the substring is found, or return false if not found. This function is case-insensitive.

endsWith('<text>', '<searchText>')
Parameter Required Type Description
<text> Yes string The string to check
<searchText> Yes string The ending substring to find
Return value Type Description
true or false Boolean Return true when the ending substring is found. Return false if not found

Example 1

This example checks whether the hello world string ends with the string world:

endsWith('hello world', 'world')

And it returns the result true.

Example 2

This example checks whether the hello world string ends with the string universe:

endsWith('hello world', 'universe')

And it returns the result false.

equals

Check whether both values, expressions, or objects are equivalent. Return true if both are equivalent, or return false if they're not equivalent.

equals('<object1>', '<object2>')
Parameter Required Type Description
<object1>, <object2> Yes any The values, expressions, or objects to compare
Return value Type Description
true or false Boolean Return true when both are equivalent. Return false if not equivalent.

Example

These examples check whether the specified inputs are equivalent:

equals(true, 1)
equals('abc', 'abcd')

And returns these results respectively:

  • Both values are equivalent, so the function returns true.
  • Both values aren't equivalent, so the function returns false.

exists

Evaluates an expression for truthiness.

exists(expression)
Parameter Required Type Description
expression Yes expression Expression to evaluate for truthiness
Return value Type Description
<true or false> Boolean Result of evaluating the expression

Example

These example evaluate the truthiness of foo = {"bar":"value"}:

exists(foo.bar)
exists(foo.bar2)

And return these results respectively:

  • true
  • false

exp

Return exponentiation of one number to another.

exp(realNumber, exponentNumber)
Parameter Required Type Description
realNumber Yes number Real number to compute exponent of
exponentNumber Yes number Exponent number
Return value Type Description
<result-exp> number The result from computing exponent of realNumber

Example

This example computes the exponent:

exp(2, 2)

And returns the result 4.

first

Return the first item from a string or array.

first('<collection>')
first([<collection>])
Parameter Required Type Description
<collection> Yes string or array The collection in which to find the first item
Return value Type Description
<first-collection-item> any The first item in the collection

Example

These examples find the first item in the following collections:

first('hello')
first(createArray(0, 1, 2))

And return these results respectively:

  • h
  • 0

flatten

Flatten an array into non-array values. You can optionally set the maximum depth to flatten to.

flatten([<collection>], '<depth>')
Parameter Required Type Description
<collection> Yes array The collection to flatten
<depth> No number Maximum depth to flatten. Default is infinity.
Return value Type Description
<new-collection> array New collection whose elements have been flattened to a non-array to the specified depth

Example 1

THis example flattens the following array:

flatten(createArray(1, createArray(2), createArray(createArray(3, 4), createArray(5, 6)))

And returns the result [1, 2, 3, 4, 5, 6].

Example 2

This example flattens the array to a depth of 1:

flatten(createArray(1, createArray(2), createArray(createArray(3, 4), createArray(5, 6)), 1)

And returns the result [1, 2, [3, 4], [5, 6]].

float

Convert the string version of a floating-point number to a floating-point number. You can use this function only when passing custom parameters to an app, such as a logic app.

float('<value>')
Parameter Required Type Description
<value> Yes string The string that has a valid floating-point number to convert to
Return value Type Description
<float-value> float The floating-point number of the specified string

Example

This example creates the string version of the following floating-point number:

float('10.333')

And returns the resulting string 10.333.

foreach

Operate on each element and return the new collection.

foreach([<collection/instance>], <iteratorName>, <function>)
Parameter Required Type Description
<collection/instance> Yes array or object The collection with the items
<iteratorName> Yes iterator name The key item of arrow function
<function> Yes expression Function that contains iteratorName
Return value Type Description
<new-collection> array The new collection in which each element has been evaluated by the function

Example 1

This example generates a new collection:

foreach(createArray(0, 1, 2, 3), x, x + 1)

And return the result [1, 2, 3, 4].

Example 2

This example generates a new collection:

foreach(json("{'name': 'jack', 'age': '15'}"), x, concat(x.key, ':', x.value))

And returns the result ['name:jack', 'age:15'].

formatDateTime

Return a timestamp in the specified format.

formatDateTime('<timestamp>', '<format>'?)
Parameter Required Type Description
<timestamp> Yes string The string that contains the timestamp
<format> No string A custom format pattern. The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
Return value Type Description
<reformatted-timestamp> string The updated timestamp in the specified format

Examples

These examples convert a timestamp or a Unix timestamp to the specified format:

formatDateTime('03/15/2018 12:00:00', 'yyyy-MM-ddTHH:mm:ss')

And returns the following results:

  • 2018-03-15T12:00:00

formatEpoch

Return a timestamp in the specified format from UNIX time (also know as Epoch time, POSIX time, UNIX Epoch time).

formatEpoch('<epoch>', '<format>'?)
Parameter Required Type Description
<epoch> Yes number The epoch number
<format> No string A custom format pattern. The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
Return value Type Description
<reformatted-timestamp> string The updated timestamp in the specified format

Examples

This example convert a Unix timestamp to the specified format:

formatEpoch(1521118800, 'yyyy-MM-ddTHH:mm:ss.fffZ)'

And returns the result 2018-03-15T12:00:00.000Z.

formatTicks

Return a timestamp in the specified format from ticks.

formatTicks('<ticks>', '<format>'?)
Parameter Required Type Description
<epoch> Yes number (or bigint in Javascript) The ticks number
<format> No string A custom format pattern. The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
Return value Type Description
<reformatted-timestamp> string The updated timestamp in the specified format

Examples

This example converts ticks to the specified format:

formatTicks(637243624200000000, 'yyyy-MM-ddTHH:mm:ss.fffZ)'

And returns the result 2020-05-06T11:47:00.000Z.

getFutureTime

Return the current timestamp plus the specified time units.

getFutureTime(<interval>, <timeUnit>, '<format>'?)
Parameter Required Type Description
<interval> Yes integer The number of specific time units to add
<timeUnit> Yes string The unit of time to use with interval. Possible units are "Second", "Minute", "Hour", "Day", "Week", "Month", and "Year".
<format> No string A custom format pattern. The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
Return value Type Description
<updated-timestamp> string The current timestamp plus the specified number of time units

Example 1

Suppose the current timestamp is 2019-03-01T00:00:00.000Z. The example below adds five days to that timestamp:

getFutureTime(2, 'Week')

And returns the result 2019-03-15T00:00:00.000Z.

Example 2

Suppose the current timestamp is 2018-03-01T00:00:00.000Z. The example below adds five days to the timestamp and converts the result to MM-DD-YY format:

getFutureTime(5, 'Day', 'MM-DD-YY')

It returns the result 03-06-18.

getPastTime

Return the current timestamp minus the specified time units.

getPastTime(<interval>, <timeUnit>, '<format>'?)
Parameter Required Type Description
<interval> Yes integer The number of specific time units to substract
<timeUnit> Yes string The unit of time to use with interval. Possible units are "Second", "Minute", "Hour", "Day", "Week", "Month", and "Year".
<format> No string A custom format pattern. The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
Return value Type Description
<updated-timestamp> string The current timestamp minus the specified number of time units

Example 1

Suppose the current timestamp is 2018-02-01T00:00:00.000Z. This example adds five days to that timestamp:

getPastTime(5, 'Day')

And returns the result 2019-01-27T00:00:00.000Z.

Example 2

Suppose the current timestamp is 2018-03-01T00:00:00.000Z. This example adds five days to the timestamp, converts the result to MM-DD-YY format:

getPastTime(5, 'Day', 'MM-DD-YY')

It returns the result 02-26-18.

getProperty

Retrieve the value of the specified property from the JSON object.

getProperty(<JSONObject>, '<Property>')
Parameter Required Type Description
<JSONObject> Yes object The JSON Object contains the property and value you want to get
<property> Yes string The specified property you want to get from the JSON object
Return value Type Description
value object The value of the specified property you want to get in the JSON object

Example

This example gets properties from item = {'name': 'myName', 'age': 18, 'state': ['single', 'junior', 'Grade A']}:

getProperty(item, 'state')

And returns the result ['single', 'junior', 'Grade A'].

getTimeOfDay

Returns time of day for a given timestamp.

getTimeOfDay('<timestamp>')

Time returned is one of the following strings:

Parameter Required Type Description
<timestamp> Yes string The string that contains the specified timestamp
Return value Type Description
<time-of-day> string The time of day for the specified timestamp

Listed below are the strings associated with the time of day:

Time of day Timestamp
midnight 12AM
morning 12:01AM – 11:59PM
afternoon 12PM
evening 06:00PM – 10:00PM
night 10:01PM – 11:59PM

Example

getTimeOfDay('2018-03-15T08:00:00.000Z')

Returns the result morning.

greater

Check whether the first value is greater than the second value. Return true if the first value is more, or return false if less.

greater(<value>, <compareTo>)
greater('<value>', '<compareTo>')
Parameter Required Type Description
<value> Yes integer, float, or string The first value to check whether greater than the second value
<compareTo> Yes integer, float, or string, respectively The comparison value
Return value Type Description
true or false Boolean Return true if the first value is greater than the second value. Return false if the first value is equal to or less than the second value.

Example

These examples check whether the first value is greater than the second value:

greater(10, 5)
greater('apple', 'banana')

And return the following results respectively:

  • true
  • false

greaterOrEquals

Check whether the first value is greater than or equal to the second value. Return true when the first value is greater or equal, or return false if the first value is less.

greaterOrEquals(<value>, <compareTo>)
greaterOrEquals('<value>', '<compareTo>')
Parameter Required Type Description
<value> Yes integer, float, or string The first value to check whether greater than or equal to the second value
<compareTo> Yes integer, float, or string, respectively The comparison value
Return value Type Description
true or false Boolean Return true if the first value is greater than or equal to the second value. Return false if the first value is less than the second value.

Example

These examples check whether the first value is greater or equal than the second value:

greaterOrEquals(5, 5)
greaterOrEquals('apple', 'banana')

And return the following results respectively:

  • true
  • false

if

Check whether an expression is true or false. Based on the result, return a specified value.

if(<expression>, <valueIfTrue>, <valueIfFalse>)
Parameter Required Type Description
<expression> Yes Boolean The expression to check
<valueIfTrue> Yes any The value to return if the expression is true
<valueIfFalse> Yes any The value to return if the expression is false
Return value Type Description
<specified-return-value> any The specified value that returns based on whether the expression is true or false

Example

This example evaluates whether equals(1,1) is true:

if(equals(1, 1), 'yes', 'no')

And returns yes because the specified expression returns true. Otherwise, the example returns no.

indexOf

Return the starting position or index value of a substring. This function is case-insensitive, and indexes start with the number 0.

indexOf('<text>', '<searchText>')
Parameter Required Type Description
<text> Yes string or array The string that has the substring to find
<searchText> Yes string The substring to find
Return value Type Description
<index-value> integer The starting position or index value of the specified substring.
If the string is not found, return the number -1.

Example 1

This example finds the starting index value of the substring world in the string hello world:

indexOf('hello world', 'world')

And returns the result 6.

Example 2

This example finds the starting index value of the substring def in the array ['abc', 'def', 'ghi']:

indexOf(createArray('abc', 'def', 'ghi'), 'def')

And returns the result 1.

indicesAndValues

Turn an array or object into an array of objects with index (current index) and value properties. For arrays, the index is the position in the array. For objects, it is the key for the value.

indicesAndValues('<collection or object>')
Parameter Required Type Description
<collection or object> Yes array or object Original array or object
Return value Type Description
<collection> array New array. Each item has two properties: the index with the position in an array or the key for an object, and the corresponding value.

Example 1

Say you have a list { items: ["zero", "one", "two"] }. The following function takes that list:

indicesAndValues(items)

And returns a new list:

[
  {
    index: 0,
    value: 'zero'
  },
  {
    index: 1,
    value: 'one'
  },
  {
    index: 2,
    value: 'two'
  }
]

Example 2

Say you have a list { items: ["zero", "one", "two"] }. The following function takes that list:

where(indicesAndValues(items), elt, elt.index >= 1)

And returns a new list:

[
  {
    index: 1,
    value: 'one'
  },
  {
    index: 2,
    value: 'two'
  }
]

Example 3

Say you have a list { items: ["zero", "one", "two"] }. The following function takes that list:

join(foreach(indicesAndValues(items), item, item.value), ',')

And returns the result zero,one,two. This expression has the same effect as join(items, ',').

Example 4

Say you have an object { user: {name: 'jack', age: 20} }. The following function takes that object:

indicesAndValues(user)

And returns a new object:

[
  {
    index: 'name',
    value: 'jack'
  },
  {
    index: 'age',
    value: 20
  }
]

int

Return the integer version of a string.

int('<value>')
Parameter Required Type Description
<value> Yes string The string to convert
Return value Type Description
<integer-result> integer The integer version of the specified string

Example

This example creates an integer version for the string 10:

int('10')

And returns the result as the integer 10.

intersection

Return a collection that has only the common items across the specified collections. To appear in the result, an item must appear in all the collections passed to this function. If one or more items have the same name, the last item with that name appears in the result.

intersection([<collection1>], [<collection2>], ...)
intersection('<collection1>', '<collection2>', ...)
Parameter Required Type Description
<collection1>, <collection2> Yes array or object, but not both The collections from which you want only the common items
Return value Type Description
<common-items> array or object, respectively A collection that has only the common items across the specified collections

Example

This example finds the common items across the following arrays:

intersection(createArray(1, 2, 3), createArray(101, 2, 1, 10), createArray(6, 8, 1, 2))

And returns an array with only the items [1, 2].

isArray

Return true if a given input is an array.

isArray('<input>')
Parameter Required Type Description
<input> Yes any The input to be tested
Return value Type Description
<Boolean-result> Boolean Return true if a given input is an array, or return false if it is not an array.

Examples

The following examples check if the input is an array:

isArray('hello')
isArray(createArray('hello', 'world'))

And return the following results respectively:

  • The input is a string, so the function returns false.
  • The input is an array, so the function returns true.

isBoolean

Return true if a given input is a Boolean.

isBoolean('<input>')
Parameter Required Type Description
<input> Yes any The input to be tested
Return value Type Description
<Boolean-result> Boolean Return true if a given input is a Boolean, or return false if it not a Boolean.

Examples

The following examples check if the input is a Boolean:

isBoolean('hello')
isBoolean(32 > 16)

And return the following results respectively:

  • The input is a string, so the function returns false.
  • The input is a Boolean, so the function returns true.

isDate

Return true if a given TimexProperty or Timex expression refers to a valid date. Valid dates contain the month and dayOfMonth, or contain the dayOfWeek.

isDate('<input>')
Parameter Required Type Description
<input> Yes bbject or string The input TimexProperty object or a Timex expression string.
Return value Type Description
<boolean-result> Boolean Return true if the input refers to a valid date, or return false if the date is invalid.

Examples

These examples check if the following inputs are valid dates:

isDate('2020-12')
isDate('xxxx-12-21')

And return the following results:

  • false
  • true

isDateRange

Return true if a given TimexProperty or Timex expression refers to a valid date range.

isDateRange('<input>')
Parameter Required Type Description
<input> Yes object or string The input TimexProperty object a Timex expression string.
Return value Type Description
<boolean-result> Boolean Return true if given input refers to a valid date range, or return false if it is not a valid date range.

Examples

These examples check if the following input is a valid date range:

isDateRange('PT30M')
isDateRange('2012-02')

And return the following results:

  • false
  • true

isDateTime

Return true if a given input is a UTC ISO format (YYYY-MM-DDTHH:mm:ss.fffZ) timestamp string.

isDateTime('<input>')
Parameter Required Type Description
<input> Yes any The input to be tested
Return value Type Description
<Boolean-result> Boolean Return true if a given input is a UTC ISO format timestamp string, or return false if it is not a UTC ISO format timestamp string.

Examples

The following examples check if the input is a UTC ISO format string:

isDateTime('hello world!')
isDateTime('2019-03-01T00:00:00.000Z')

And return the following results respectively:

  • The input is a string, so the function returns false.
  • The input is a UTC ISO format string, so the function returns true.

isDefinite

Return true if a given TimexProperty or Timex expression refers to a valid date. Valid dates contain the year, month and dayOfMonth.

isDefinite('<input>')
Parameter Required Type Description
<input> Yes object or string The input TimexProperty object a Timex expression string.
Return value Type Description
<boolean-result> Boolean Return true if the given input refers to a valid full date, or return false if it does not refere to a valid full date.

Examples

Suppose there is a TimexProperty object validFullDate = new TimexProperty("2020-02-20") and the Now property is set to true. The following examples check if the object refers a valid full date:

isDefinite('xxxx-12-21')
isDefinite(validFullDate)

And return the following results respectively:

  • false
  • true

isDuration

Return true if a given TimexProperty or Timex expression refers to a valid duration.

isDuration('<input>')
Parameter Required Type Description
<input> Yes object or string The input TimexProperty object a Timex expression string.
Return value Type Description
<boolean-result> Boolean Return true if the input refers to a valid duration, or return false if the input doesn't refer to a valid duration.

Examples

The examples below check if the following input refers to a valid duration:

isDuration('PT30M')
isDuration('2012-02')

And return the following results respectively:

  • true
  • false

isFloat

Return true if a given input is a floating-point number. Due to the alignment between C#and JavaScript, a number with an non-zero residue of its modulo 1 will be treated as a floating-point number.

isFloat('<input>')
Parameter Required Type Description
<input> Yes any The input to be tested
Return value Type Description
<Boolean-result> Boolean Return true if a given input is a floating-point number, or return false if the input is not a floating-point number.

Examples

The following examples check if the input is a floating-point number:

isFloat('hello world!')
isFloat(1.0)
isFloat(12.01)

And return the following results respectively:

  • The input is a string, so the function returns false.
  • The input has a modulo that equals 0, so the function returns false.
  • The input is a floating-point number, so the function returns true.

isInteger

Return true if a given input is an integer number. Due to the alignment between C# and JavaScript, a number with an zero residue of its modulo 1 will be treated as an integer number.

isInteger('<input>')
Parameter Required Type Description
<input> Yes any The input to be tested
Return value Type Description
<Boolean-result> Boolean Is the input is an integer number

Examples

The following examples check if the input is an integer:

isInteger('hello world!')
isInteger(1.0)
isInteger(12)

And return the following results respectively:

  • The input is a string, so the function returns false.
  • The input has a modulo that equals 0, so the function returns true.
  • The input is an integer, so the function returns true.

isMatch

Return true if a given string is matches a specified regular expression pattern.

isMatch('<target**string>', '<pattern>')
Parameter Required Type Description
<target**string> Yes string The string to be matched
<pattern> Yes string A regular expression pattern
Return value Type Description
<Boolean-result> Boolean Return true if a given string is matches a common regular expression pattern, or return false if it does not match the pattern.

Examples

The following examples check if the input matches the specified regular expression pattern:

isMatch('ab', '^[a-z]{1,2}$')
isMatch('FUTURE', '(?i)fortune|future')
isMatch('12abc34', '([0-9]+)([a-z]+)([0-9]+)')
isMatch('abacaxc', 'ab.*?c')

And return the same result true.

isObject

Return true if a given input is a complex object or return false if it is a primitive object. Primitive objects include strings, numbers, and Booleans; complex types, like classes, contain properties.

isObject('<input>')
Parameter Required Type Description
<input> Yes any The input to be tested
Return value Type Description
<Boolean-result> Boolean Return true if a given input is a complex object, or return false if it is a primitive object.

Examples

The following examples check if the given input is an object:

isObject('hello world!')
isObject({userName: "Sam"})

And return the following results respectively:

  • The input is a string, so the function returns false.
  • The input is an object, so the function returns true.

isPresent

Return true if a given TimexProperty or Timex expression refers to the present.

isPresent('<input>')
Parameter Required Type Description
<input> Yes object or string The input TimexProperty object a Timex expression string
Return value Type Description
<boolean-result> Boolean Return true if the input refers to the present, or return false if it doesn't refere to the present.

Examples Suppose we have an TimexProperty object validNow = new TimexProperty() { Now = true } and set the Now property to true. The examples below check if the following input refers to the present:

isPresent('PT30M')
isPresent(validNow)

And return the following results respectively:

  • false
  • true

isString

Return true if a given input is a string.

isString('<input>')
Parameter Required Type Description
<input> Yes any The input to be tested
Return value Type Description
<Boolean-result> Boolean Return true if a given input is a string, or return false if not a string.

Examples

The following examples check if the given input is a string:

isString('hello world!')
isString(3.14)

And return the following results respectively:

  • The input is a string, so the function returns true.
  • The input is a float, so the function returns false.

isTime

Return true if a given TimexProperty or Timex expression refers to a valid time. Valid time contains hours, minutes and seconds.

isTime('<input>')
Parameter Required Type Description
<input> Yes object or string The input TimexProperty object a Timex expression string
Return value Type Description
<boolean-result> Boolean Return true if the input refers to a valid time, or return false if it doesn't refer to a valid time..

Examples

These examples check if the following input referes to a valid time:

isTime('PT30M')
isTime('2012-02-21T12:30:45')

And return the following results respectively:

  • false
  • true

isTimeRange

Return true if a given TimexProperty or Timex expression refers to a valid time range Valid time ranges contain partOfDay.

isTime('<input>')
Parameter Required Type Description
<input> Yes object or string The input TimexProperty object a Timex expression string.
Return value Type Description
<boolean-result> Boolean Return true if the input refers to a valid time range, or return false if it doesn't refer to a valid time range.

Examples

Suppose we have an TimexProperty object validTimeRange = new TimexProperty() { PartOfDay = "morning" } and set the Now property to true. These examples check if the following inputs are valid time ranges:

isTimeRange('PT30M')
isTimeRange(validTimeRange)

And return the following results respectively:

  • false
  • true

join

Return a string that has all the items from an array, with each character separated by a delimiter.

join([<collection>], '<delimiter>')
Parameter Required Type Description
<collection> Yes array The array that has the items to join
<delimiter> Yes string The separator that appears between each character in the resulting string
Return value Type Description
<char1><delimiter><char2><delimiter>... string The resulting string created from all the items in the specified array

Example

This example creates a string from all the items in this array with the specified character . as the delimiter:

join(createArray('a', 'b', 'c'), '.')

And returns the result a.b.c.

jPath

Check JSON or a JSON string for nodes or values that match a path expression, and return the matching nodes.

jPath(<json>, '<path>')
Parameter Required Type Description
<json> Yes any The JSON object or string to search for nodes or values that match the path expression value
<path> Yes any The path expression used to find matching JSONnodes or values
Return value Type Description
[ <json-node>] array An list of JSON nodes or value that matches the specified path expression

C# Example

Say you have the following JSON:

{
    "Stores": [
        "Lambton Quay",
        "Willis Street"
    ],
    "Manufacturers": [
        {
            "Name": "Acme Co",
            "Products": [
                {
                    "Name": "Anvil",
                    "Price": 50
                }
            ]
        },
        {
            "Name": "Contoso",
            "Products": [
                {
                    "Name": "Elbow Grease",
                    "Price": 99.95
                },
                {
                    "Name": "Headlight Fluid",
                    "Price": 4
                }
            ]
        }
    ]
}

The path expression is $..Products[?(@.Price >= 50)].Name

jPath(jsonStr, path)

And it returns the result ["Anvil", "Elbow Grease"].

Javascript Example

Say you have the following JSON:

{
    "automobiles": [
        {
            "maker": "Nissan",
            "model": "Teana",
            "year": 2011
        },
        {
            "maker": "Honda",
            "model": "Jazz",
            "year": 2010
        },
        {
            "maker": "Honda",
            "model": "Civic",
            "year": 2007
        },
        {
            "maker": "Toyota",
            "model": "Yaris",
            "year": 2008
        },
        {
            "maker": "Honda",
            "model": "Accord",
            "year": 2011
        }
    ],
    "motorcycles": [
        {
            "maker": "Honda",
            "model": "ST1300",
            "year": 2012
        }
    ]
}

The path expression is .automobiles{.maker === "Honda" && .year > 2009}.model.

jPath(jsonStr, path)

And it returns the result ['Jazz', 'Accord'].

json

Return the JavaScript Object Notation (JSON) type value or object of a string or XML.

json('<value>')
Parameter Required Type Description
<value> Yes string or XML The string or XML to convert
Return value Type Description
<JSON-result> string The resulting string created from all the items in the specified array

Example 1

This example converts a string to JSON:

json('{"fullName": "Sophia Owen"}')

And returns the result:

{
  "fullName": "Sophia Owen"
}

Example 2

This example converts XML to JSON:

json(xml('<?xml version="1.0"?> <root> <person id='1'> <name>Sophia Owen</name> <occupation>Engineer</occupation> </person> </root>'))

And returns the result:

{
   "?xml": { "@version": "1.0" },
   "root": {
      "person": [ {
         "@id": "1",
         "name": "Sophia Owen",
         "occupation": "Engineer"
      } ]
   }
}

last

Return the last item from a collection.

last('<collection>')
last([<collection>])
Parameter Required Type Description
<collection> Yes string or array The collection in which to find the last item
Return value Type Description
<last-collection-item> string or array, respectively The last item in the collection

Example

These examples find the last item in these collections:

last('abcd')
last(createArray(0, 1, 2, 3))

And returns the following results respectively:

  • d
  • 3

lastIndexOf

Return the starting position or index value of the last occurrence of a substring. This function is case-insensitive, and indexes start with the number 0.

lastIndexOf('<text>', '<searchText>')
Parameter Required Type Description
<text> Yes string or array The string that has the substring to find
<searchText> Yes string The substring to find
Return value Type Description
<ending-index-value> integer The starting position or index value of the last occurrence of the specified substring. If the string is not found, return the number -1.

Example 1

This example finds the starting index value of the last occurrence of the substring world in the hello world string:

lastIndexOf('hello world', 'world')

And returns the result 6.

Example 2

This example finds the starting index value of the last occurrence of substring def in the array ['abc', 'def', 'ghi', 'def'].

lastIndexOf(createArray('abc', 'def', 'ghi', 'def'), 'def')

And returns the result 3.

length

Return the length of a string.

length('<str>')
Parameter Required Type Description
<str> Yes string The string to calculate for length
Return value Type Description
<length> integer The length of this string

Examples

These examples get the length of strings:

length('hello')
length('hello world')

And returns the following results respectively:

  • 5
  • 11

less

Check whether the first value is less than the second value. Return true if the first value is less, or return false if the first value is more.

less(<value>, <compareTo>)
less('<value>', '<compareTo>')
Parameter Required Type Description
<value> Yes integer, float, or string The first value to check whether less than the second value
<compareTo> Yes integer, float, or string, respectively The comparison item
Return value Type Description
true or false Boolean Return true if the first value is less than the second value. Return false if the first value is equal to or greater than the second value.

Examples

These examples check whether the first value is less than the second value.

less(5, 10)
less('banana', 'apple')

And return the following results respectively:

  • true
  • false

lessOrEquals

Check whether the first value is less than or equal to the second value. Return true if the first value is less than or equal, or return false if the first value is more.

lessOrEquals(<value>, <compareTo>)
lessOrEquals('<value>', '<compareTo>')
Parameter Required Type Description
<value> Yes integer, float, or string The first value to check whether less than or equal to the second value
<compareTo> Yes integer, float, or string, respectively The comparison item
Return value Type Description
true or false Boolean Return true if the first value is less than or equal to the second value. Return false if the first value is greater than the second value.

Example

These examples check whether the first value is less than or equal to the second value.

lessOrEquals(10, 10)
lessOrEquals('apply', 'apple')

And return the following results respectively:

  • true
  • false

max

Return the highest value from a list or array. The list or arary is inclusive at both ends.

max(<number1>, <number2>, ...)
max([<number1>, <number2>, ...])
Parameter Required Type Description
<number1>, <number2>, ... Yes number The set of numbers from which you want the highest value
[<number1>, <number2>, ...] Yes array of numbers The array of numbers from which you want the highest value
Return value Type Description
<max-value> number The highest value in the specified array or set of numbers

Examples

These examples get the highest value from the set of numbers and the array:

max(1, 2, 3)
max(createArray(1, 2, 3))

And return the result 3.

min

Return the lowest value from a set of numbers or an array.

min(<number1>, <number2>, ...)
min([<number1>, <number2>, ...])
Parameter Required Type Description
<number1>, <number2>, ... Yes number The set of numbers from which you want the lowest value
[<number1>, <number2>, ...] Yes array of numbers The array of numbers from which you want the lowest value
Return value Type Description
<min-value> number The lowest value in the specified array or set of numbers

Examples

These examples get the lowest value in the set of numbers and the array:

min(1, 2, 3)
min(createArray(1, 2, 3))

And return the result 1.

mod

Return the remainder from dividing two numbers. To get the integer result, see div().

mod(<dividend>, <divisor>)
Parameter Required Type Description
<dividend> Yes number The number to divide by the divisor
<divisor> Yes number The number that divides the dividend. Cannot be 0.
Return value Type Description
<modulo-result> number The remainder from dividing the first number by the second number

Example

This example divides the first number by the second number:

mod(3, 2)

And returns the result 1.

month

Return the month of the specified timestamp.

month('<timestamp>')
Parameter Required Type Description
<timestamp> Yes string The string that contains the timestamp
Return value Type Description
<number-of-month> integer The number of the month in the specified timestamp

Example

month('2018-03-15T13:01:00.000Z')

And it returns the result 3.

mul

Return the product from multiplying two numbers.

mul(<multiplicand1>, <multiplicand2>)
Parameter Required Type Description
<multiplicand1> Yes integer or float The number to multiply by multiplicand2
<multiplicand2> Yes integer or float The number that multiples multiplicand1
Return value Type Description
<product-result> integer or float The product from multiplying the first number by the second number

Examples

These examples multiple the first number by the second number:

mul(1, 2)
mul(1.5, 2)

And return the following results respectively:

  • 2
  • 3

newGuid

Return a new Guid string.

newGuid()
Return value Type Description
<Guid-string> string A new Guid string, length is 36 and looks like xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx

Example

newGuid()

And it returns a result which follows the format xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx.

not

Check whether an expression is false. Return true if the expression is false, or return false if true.

not(<expression>)
Parameter Required Type Description
<expression> Yes Boolean The expression to check
Return value Type Description
true or false Boolean Return true if the expression is false. Return false if the expression is true.

Example 1

These examples check whether the specified expressions are false:

not(false)
not(true)

And return the following results respectively:

  • The expression is false, so the function returns true.
  • The expression is true, so the function returns false.

Example 2

These examples check whether the specified expressions are false:

not(equals(1, 2))
not(equals(1, 1))

And return the following results respectively:

  • The expression is false, so the function returns true.
  • The expression is true, so the function returns false.

or

Check whether at least one expression is true. Return true if at least one expression is true, or return false if all are false.

or(<expression1>, <expression2>, ...)
Parameter Required Type Description
<expression1>, <expression2>, ... Yes Boolean The expressions to check
Return value Type Description
true or false Boolean Return true if at least one expression is true. Return false if all expressions are false.

Example 1

These examples check whether at least one expression is true:

or(true, false)
or(false, false)

And return the following results respectively:

  • At least one expression is true, so the function returns true.
  • Both expressions are false, so the function returns false.

Example 2

These examples check whether at least one expression is true:

or(equals(1, 1), equals(1, 2))
or(equals(1, 2), equals(1, 3))

And return the following results respectively:

  • At least one expression is true, so the function returns true.
  • Both expressions are false, so the function returns false.

rand

Return a random integer from a specified range, which is inclusive only at the starting end.

rand(<minValue>, <maxValue>)
Parameter Required Type Description
<minValue> Yes integer The lowest integer in the range
<maxValue> Yes integer The integer that follows the highest integer in the range that the function can return
Return value Type Description
<random-result> integer The random integer returned from the specified range

Example

This example gets a random integer from the specified range, excluding the maximum value:

rand(1, 5)

And returns 1, 2, 3, or 4 as the result.

range

Return an integer array that starts from a specified integer.

range(<startIndex>, <count>)
Parameter Required Type Description
<startIndex> Yes integer An integer value that starts the array as the first item
<count> Yes integer The number of integers in the array
Return value Type Description
<range-result> integer The array with integers starting from the specified index

Example

This example creates an integer array that starts from the specified index 1 and has the specified number of integers as 4:

range(1, 4)

And returns the result [1, 2, 3, 4].

removeProperty

Remove a property from an object and return the updated object.

removeProperty(<object>, '<property>')
Parameter Required Type Description
<object> Yes object The JSON object in which you want to remove a property
<property> Yes string The name of the property to remove
Return value Type Description
<updated-object> object The updated JSON object without the specified property

Example

This example removes the accountLocation property from a customerProfile object, which is converted to JSON with the json() function, and returns the updated object:

removeProperty(json('customerProfile'), 'accountLocation')

replace

Replace a substring with the specified string, and return the result string. This function is case-sensitive.

replace('<text>', '<oldText>', '<newText>')
Parameter Required Type Description
<text> Yes string The string that has the substring to replace
<oldText> Yes string The substring to replace
<newText> Yes string The replacement string
Return value Type Description
<updated-text> string The updated string after replacing the substring. If the substring is not found, the function returns the original string.

Example 1

This example finds the substring old in the old string and replaces old with new:

replace('the old string', 'old', 'new')

The result is the string the new string.

Example 2

When dealing with escape characters, the expression engine handles the unescape for you. This function replaces strings with escape characters.

replace('hello\"', '\"', '\n')
replace('hello\n', '\n', '\\\\')
@"replace('hello\\', '\\', '\\\\')"
@"replace('hello\n', '\n', '\\\\')"

And returns the following results respectively:

  • hello\n
  • hello\\
  • @"hello\\\\"
  • @"hello\\\\"

replaceIgnoreCase

Replace a substring with the specified string, and return the result string. This function is case-insensitive.

replaceIgnoreCase('<text>', '<oldText>', '<newText>')
Parameter Required Type Description
<text> Yes string The string that has the substring to replace
<oldText> Yes string The substring to replace
<newText> Yes string The replacement string
Return value Type Description
<updated-text> string The updated string after replacing the substring. If the substring is not found, return the original string.

Example

This example finds the substring old in the string the old string and replaces old with new:

replace('the old string', 'old', 'new')

And returns the result the new string.

select

Operate on each element and return the new collection of transformed elements.

select([<collection/instance>], <iteratorName>, <function>)
Parameter Required Type Description
<collection/instance> Yes array The collection with the items
<iteratorName> Yes iterator name The key item of arrow function
<function> Yes expression Th function that can contains iteratorName
Return value Type Description
<new-collection> array The new collection in which each element has been evaluated with the function

Example 1

This example generates a new collections:

select(createArray(0, 1, 2, 3), x, x + 1)

And returns the result [1, 2, 3, 4].

Example 2

This example generates a new collection from an instance:

select(json("{'name': 'jack', 'age': '15'}"), x, concat(x.key, ':', x.value))

And returns the result ['name:jack', 'age:15'].

setPathToValue

Retrieve the value of the specified property from the JSON object.

setPathToValue(<path>, <value>)
Parameter Required Type Description
<Path> Yes object The path which you want to set
<value> Yes object The value you want to set to the path
Return value Type Description
value object The value be set

Example 1

The example below sets the value 1 to the path:

setPathToValue(path.x, 1)

And returns the result 1. path.x is set to 1.

Example 2

This example below sets the value:

setPathToValue(path.array[0], 7) + path.array[0]

And returns the result 14.

setProperty

Set the value of an object's property and return the updated object. To add a new property, use this function or the addProperty() function.

setProperty(<object>, '<property>', <value>)
Parameter Required Type Description
<object> Yes object The JSON object in which you want to set a property
<property> Yes string The name of the property to set
<value> Yes any The value to set for the specified property
Return value Type Description
<updated-object> object The updated JSON object whose property you set

Example

This example sets the accountNumber property on a customerProfile object, which is converted to JSON with the json() function. The function assigns a value generated by the newGuid() function, and returns the updated JSON object:

setProperty(json('customerProfile'), 'accountNumber', newGuid())

skip

Remove items from the front of a collection, and return all the other items.

skip([<collection>], <count>)
Parameter Required Type Description
<collection> Yes array The collection whose items you want to remove
<count> Yes integer A positive integer for the number of items to remove at the front
Return value Type Description
<updatedCollection> array The updated collection after removing the specified items

Example

This example removes one item, the number 1, from the front of the specified array:

skip(createArray(0, 1, 2, 3), 1)

And returns an array with the remaining items: [1,2,3].

sortBy

Sort elements in the collection in ascending order and return the sorted collection.

sortBy([<collection>], '<property>')
Parameter Required Type Description
<collection> Yes string or array The collection to sort
<property> No string Sort by this specific property of the object element in the collection if set
Return value Type Description
<new-collection> array The new collection whose elements have been sorted

Example 1

This example generates sorts the following collection:

sortBy(createArray(1, 2, 0, 3))

And return the result [0, 1, 2, 3].

Example 2

Suppose you have the following collection:

{
  'nestedItems': [
    {'x': 2},
    {'x': 1},
    {'x': 3}
  ]
}

This example generates a new sorted collection based on the x object property

sortBy(nestedItems, 'x')

And returns the result:

{
  'nestedItems': [
    {'x': 1},
    {'x': 2},
    {'x': 3}
  ]
}

sortByDescending

Sort elements in the collection in descending order, and return the sorted collection.

sortBy([<collection>], '<property>')
Parameter Required Type Description
<collection> Yes string or array The collection to sort
<property> No string Sort by this specific property of the object element in the collection if set
Return value Type Description
<new-collection> array The new collection whose elements have been sorted

Example 1

This example generates a new sorted collection:

sortByDescending(createArray(1, 2, 0, 3))

And returns the result [3, 2, 1, 0].

Example 2

Suppose you have the following collection:

{
  'nestedItems': [
    {'x': 2},
    {'x': 1},
    {'x': 3}
  ]
}

This example generates a new sorted collection based on the x object property:

sortByDescending(nestedItems, 'x')

And returns this result:

{
  'nestedItems': [
    {'x': 3},
    {'x': 2},
    {'x': 1}
  ]
}

split

Return an array that contains substrings, separated by commas, based on the specified delimiter character in the original string.

split('<text>', '<delimiter>'?)
Parameter Required Type Description
<text> Yes string The string to separate into substrings based on the specified delimiter in the original string. If the text is a null value, it will be taken as an empty string.
<delimiter> No string The character in the original string to use as the delimiter. If no delimiter provided or the delimiter is a null value, the default value will be an empty string.
Return value Type Description
[<substring1>,<substring2>,...] array An array that contains substrings from the original string, separated by commas

Examples

These examples create an array with substrings from the specified string based on the specified delimiter character:

split('a**b**c', '**')
split('hello', '')
split('', 'e')
split('', '')
split('hello')

And returns the following arrays as the result repsectively:

  • ["a", "b", "c"]
  • ["h", "e", "l", "l", "o"]
  • [""], [ ]
  • ["h", "e", "l", "l", "o"]

startOfDay

Return the start of the day for a timestamp.

startOfDay('<timestamp>', '<format>'?)
Parameter Required Type Description
<timestamp> Yes string The string that contains the timestamp
<format> No string A custom format pattern. The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
Return value Type Description
'<updated-timestamp>' string The specified timestamp starting at the zero-hour mark for the day

Example

This example finds the start of the day:

startOfDay('2018-03-15T13:30:30.000Z')

And returns the result 2018-03-15T00:00:00.000Z.

startOfHour

Return the start of the hour for a timestamp.

startOfHour('<timestamp>', '<format>'?)
Parameter Required Type Description
<timestamp> Yes string The string that contains the timestamp
<format> No string A custom format pattern. The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
Return value Type Description
'<updated-timestamp>' string The specified timestamp starting at the zero-minute mark for the day

Example

This example finds the start of the hour:

startOfHour('2018-03-15T13:30:30.000Z')

And returns the result 2018-03-15T13:00:00.000Z.

startOfMonth

Return the start of the month for a timestamp.

startOfDay('<timestamp>', '<format>'?)
Parameter Required Type Description
<timestamp> Yes string The string that contains the timestamp
<format> No string A custom format pattern. The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
Return value Type Description
'<updated-timestamp>' string The specified timestamp starting on the first day of the month at the zero-hour mark

Example

This example finds the start of the month:

startOfDay('2018-03-15T13:30:30.000Z')

And returns the result 2018-03-01T00:00:00.000Z.

startsWith

Check whether a string starts with a specific substring. Return true if the substring is found, or return false if not found. This function is case-insensitive.

startsWith('<text>', '<searchText>')
Parameter Required Type Description
<text> Yes string The string to check
<searchText> Yes string The starting substring to find
Return value Type Description
true or false Boolean Return true if the starting substring is found. Return false if not found

Example 1

This example checks whether the string hello world starts with the string hello:

startsWith('hello world', 'hello')

And returns the result true.

Example 2

This example checks whether the string hello world starts with the string greeting:

startsWith('hello world', 'greeting')

And returns the result false.

string

Return the string version of a value.

string(<value>)
Parameter Required Type Description
<value> Yes any The value to convert
Return value Type Description
<string-value> string The string version of the specified value

Example 1

This example creates the string version of the number 10:

string(10)

And returns the string result 10.

Example 2

This example creates a string for the specified JSON object and uses the backslash character,\\, as an escape character for the double-quotation mark character, ".

string( { "name": "Sophie Owen" } )

And returns the result { \"name\": \"Sophie Owen\" }

sub

Return the result from subtracting the second number from the first number.

sub(<minuend>, <subtrahend>)
Parameter Required Type Description
<minuend> Yes number The number from which to subtract the subtrahend
<subtrahend> Yes number The number to subtract from the minuend
Return value Type Description
<result> number The result from subtracting the second number from the first number

Example

This example subtracts the second number from the first number:

sub(10.3, .3)

And returns the result 10.

subArray

Returns a subarray from specified start and end positions. Index values start with the number 0.

subArray(<Array>, <startIndex>, <endIndex>)
Parameter Required Type Description
<array> Yes array The array to create the subarray from
<startIndex> Yes integer A positive number equal to or greater than 0 to use as the starting position or index value
<endIndex> Yes integer A positive number equal to or greater than 0 to use as the ending position or index value
Return value Type Description
<subarray-result> array A subarray with the specified number of items, starting at the specified index position in the source string

Example

This example creates a subarray from the specified array:

subArray(createArray('H','e','l','l','o'), 2, 5)

And returns the result ["l", "l", "o"].

substring

Return characters from a string, starting from the specified position or index. Index values start with the number 0.

substring('<text>', <startIndex>, <length>)
Parameter Required Type Description
<text> Yes string The string to create the substring from
<startIndex> Yes integer A positive number equal to or greater than 0 subarray to use as the starting position or index value
<length> Yes integer A positive number of characters subarray in the substring
Return value Type Description
<substring-result> string A substring with the specified number of characters, starting at the specified index position in the source string

Example

This example creates a five-character substring from the specified string, starting from the index value 6:

substring('hello world', 6, 5)

And returns the result world.

subtractFromTime

Subtract a number of time units from a timestamp. See also getPastTime().

subtractFromTime('<timestamp>', <interval>, '<timeUnit>', '<format>'?)
Parameter Required Type Description
<timestamp> Yes string The string that contains the timestamp
<interval> Yes integer The number of specified time units to subtract
<timeUnit> Yes string The unit of time to use with interval. Possible units are "Second", "Minute", "Hour", "Day", "Week", "Month", and "Year".
<format> No string A custom format pattern. The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
Return value Type Description
<updated-timestamp> string The timestamp minus the specified number of time units

Example 1

This example subtracts one day from the following timestamp:

subtractFromTime('2018-01-02T00:00.000Z', 1, 'Day')

And returns the result 2018-01-01T00:00:00.000Z.

Example 2

This example subtracts one day from the following timestamp:

subtractFromTime('2018-01-02T00:00.000Z', 1, 'Day', 'D')

And returns the result using the optional D format: Monday, January, 1, 2018.

sum

Return the result from adding numbers in a list.

add([<list of numbers>])
Parameter Required Type Description
[<list of numbers>] Yes array of numbers The numbers to add
Return value Type Description
<result-sum> number The result from adding the specified numbers

Example

This example adds the specified numbers:

add(createArray(1, 1.5))

And returns the result 2.5.

take

Return items from the front of a collection.

take('<collection>', <count>)
take([<collection>], <count>)
Parameter Required Type Description
<collection> Yes string or array The collection whose items you want
<count> Yes integer A positive integer for the number of items you want from the front
Return value Type Description
<subset> or [<subset>] String or Array, respectively A string or array that has the specified number of items taken from the front of the original collection

Example

These examples get the specified number of items from the front of these collections:

take('abcde', 3)
take(createArray(0, 1, 2, 3, 4), 3)

And return the following results respectively:

  • abc
  • [0, 1, 2]

ticks

Return the ticks property value of a specified timestamp. A tick is 100-nanosecond interval.

ticks('<timestamp>')
Parameter Required Type Description
<timestamp> Yes string The string for a timestamp
Return value Type Description
<ticks-number> integer (bigint in Javascript) The number of ticks since the specified timestamp

Example

The example convert a timestamp to its ticks property

ticks('2018-01-01T08:00:00.000Z')

And returns the result 636503904000000000.

toLower

Return a string in lowercase format. If a character in the string doesn't have a lowercase version, that character stays unchanged in the returned string.

toLower('<text>')
Parameter Required Type Description
<text> Yes string The string to return in lowercase format
Return value Type Description
<lowercase-text> string The original string in lowercase format

Example

This example converts a string to lowercase:

toLower('Hello World')

And returns the result hello world.

toUpper

Return a string in uppercase format. If a character in the string doesn't have an uppercase version, that character stays unchanged in the returned string.

toUpper('<text>')
Parameter Required Type Description
<text> Yes string The string to return in uppercase format
Return value Type Description
<uppercase-text> string The original string in uppercase format

Example

This example converts a string to uppercase:

toUpper('Hello World')

And returns the result HELLO WORLD.

trim

Remove leading and trailing whitespace from a string, and return the updated string.

trim('<text>')
Parameter Required Type Description
<text> Yes string The string that has the leading and trailing whitespace to remove
Return value Type Description
<updatedText> string An updated version for the original string without leading or trailing whitespace

Example

This example removes the leading and trailing whitespace from the string " Hello World ":

trim(' Hello World  ')

And returns the trimmed result Hello World.

union

Return a collection that has all the items from the specified collections. To appear in the result, an item can appear in any collection passed to this function. If one or more items have the same name, the last item with that name appears in the result.

union('<collection1>', '<collection2>', ...)
union([<collection1>], [<collection2>], ...)
Parameter Required Type Description
<collection1>, <collection2>, ... Yes array or object, but not both The collections from where you want all the items
Return value Type Description
<updatedCollection> array or object, respectively A collection with all the items from the specified collections. No duplicates added.

Example

This example gets all the items from the following collections:

union(createArray(1, 2, 3), createArray(1, 2, 10, 101))

And returns the result [1, 2, 3, 10, 101].

unique

Remove all duplicates from an array.

unique([<collection>])
Parameter Required Type Description
<collection> Yes array The collection to modify
Return value Type Description
<new-collection> array New collection with duplicate elements removed

Example 1

This example removes duplicate elements from the following array:

unique(createArray(1, 2, 1))

And returns the result [1, 2].

uriComponent

Return the binary version of a uniform resource identifier (URI) component.

uriComponent('<value>')
Parameter Required Type Description
<value> Yes string The string to convert to URI-encoded format
Return value Type Description
<encoded-uri> string The URI-encoded string with escape characters

Example

This example creates a URI-encoded version of a string:

uriComponent('https://contoso.com')

And returns the result http%3A%2F%2Fcontoso.com.

uriComponentToString

Return the string version of a uniform resource identifier (URI) encoded string, effectively decoding the URI-encoded string.

uriComponentToString('<value>')
Parameter Required Type Description
<value> Yes string The URI-encoded string to decode
Return value Type Description
<binary-for-encoded-uri> string The decoded version for the URI-encoded string

Example

This example creates the decoded string version of a URI-encoded string:

uriComponentToString('http%3A%2F%2Fcontoso.com')

And returns the result https://contoso.com.

uriHost

Return the host value of a unified resource identifier (URI).

uriHost('<uri>')
Parameter Required Type Description
<uri> Yes string The URI whose host value you want
Return value Type Description
<host-value> string The host value of the specified URI

Example

This example finds the host value of the following URI:

uriHost('https://www.localhost.com:8080')

And returns the result www.localhost.com.

uriPath

Return the path value of a unified resource identifier (URI).

uriPath('<uri>')
Parameter Required Type Description
<uri> Yes string The URI whose path value you want
Return value Type Description
<path-value> string The path value of the specified URI

Example

This example finds the path value of the following URI:

uriPath('http://www.contoso.com/catalog/shownew.htm?date=today')

And returns the result /catalog/shownew.htm.

uriPathAndQuery

Return the path and query value of a unified resource identifier (URI).

uriPathAndQuery('<uri>')
Parameter Required Type Description
<uri> Yes string The URI whose path and query value you want
Return value Type Description
<path-query-value> string The path and query value of the specified URI

Example

This example finds the path and query value of the following URI:

uriPathAndQuery('http://www.contoso.com/catalog/shownew.htm?date=today')

And returns the result /catalog/shownew.htm?date=today.

uriPort

Return the port value of a unified resource identifier (URI).

uriPort('<uri>')
Parameter Required Type Description
<uri> Yes string The URI whose path value you want
Return value Type Description
<port-value> string The port value of the specified URI

Example

This example finds the port value of the following URI:

uriPort('http://www.localhost:8080')

And returns the result 8080.

uriQuery

Return the query value of a unified resource identifier (URI).

uriQuery('<uri>')
Parameter Required Type Description
<uri> Yes string The URI whose query value you want
Return value Type Description
<query-value> string The query value of the specified URI

Example

This example finds the query value of the following URI:

uriQuery('http://www.contoso.com/catalog/shownew.htm?date=today')

And returns the result ?date=today.

uriScheme

Return the scheme value of a unified resource identifier (URI).

uriScheme('<uri>')
Parameter Required Type Description
<uri> Yes string The URI whose query value you want
Return value Type Description
<scheme-value> string The scheme value of the specified URI

Example

This example finds the scheme value of the following URI:

uriQuery('http://www.contoso.com/catalog/shownew.htm?date=today')

And returns the result http.

utcNow

Return the current timestamp.

utcNow('<format>')

Optionally, you can specify a different format with the <format> parameter.

Parameter Required Type Description
<format> No string A custom format pattern. The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
Return value Type Description
<current-timestamp> string The current date and time

Example 1

Suppose the date is April 15, 2018 at 1:00:00 PM. This example gets the timestamp:

utcNow()

And returns the result 2018-04-15T13:00:00.000Z.

Example 2

Suppose the date is April 15, 2018 at 1:00:00 PM. This example gets the current timestamp using the optional D format:

utcNow('D')

And returns the result Sunday, April 15, 2018.

where

Filter on each element and return the new collection of filtered elements which match a specific condition.

where([<collection/instance>], <iteratorName>, <function>)
Parameter Required Type Description
<collection/instance> Yes array The collection with the items
<iteratorName> Yes iterater name The key item of arrow function
<function> Yes expression Condition function used to filter items
Return value Type Description
<new-collection/new-object> array/object The new collection which each element has been filtered with the function

Example 1

This example generates a new collections:

where(createArray(0, 1, 2, 3), x, x > 1)

And returns the result [2, 3].

Example 2

This example generates a new object:

where(json("{'name': 'jack', 'age': '15'}"), x, x.value == 'jack')

And returns the result {'name': 'jack'}.

xml

C# only. Return the XML version of a string that contains a JSON object.

xml('<value>')
Parameter Required Type Description
<value> Yes string The string with the JSON object to convert The JSON object must have only one root property, which can't be an array. Use \ as an escape character for the double quotation mark (").
Return value Type Description
<xml-version> object The encoded XML for the specified string or JSON object

Example 1

This example creates the XML version for a string, which contains a JSON object:

xml(json('{ \"name\": \"Sophia Owen\" }'))

And returns the result XML:

<name>Sophia Owen</name>

Example 2

Suppose you have a person JSON object, seen below:

{
  "person": {
    "name": "Sophia Owen",
    "city": "Seattle"
  }
}

This example creates XML of a string that contains this JSON object:

xml(json('{\"person\": {\"name\": \"Sophia Owen\", \"city\": \"Seattle\"}}'))

And returns the result XML:

<person>
  <name>Sophia Owen</name>
  <city>Seattle</city>
<person

xPath

C# only. Check XML for nodes or values that match an XPath (XML Path Language) expression, and return the matching nodes or values. An XPath expression (referred to as XPath) helps you navigate an XML document structure so that you can select nodes or compute values in the XML content.

xPath('<xml>', '<xpath>')
Parameter Required Type Description
<xml> Yes any The XML string to search for nodes or values that match an XPath expression value
<xPath> Yes any The XPath expression used to find matching XML nodes or values
Return value Type Description
<xml-node> XML An XML node when only a single node matches the specified XPath expression
<value> any The value from an XML node when only a single value matches the specified XPath expression
<[, , ...] -or- [, , ...]> array An array with XML nodes or values that match the specified XPath expression

Example 1

This example finds nodes that match the <name></name> node in the specified arguments, and returns an array with those node values:

xpath(items, '/produce/item/name')

The arguments include the items string, which contains this XML:

"<?xml version="1.0"?> <produce> <item> <name>Gala</name> <type>apple</type> <count>20</count> </item> <item> <name>Honeycrisp</name> <type>apple</type> <count>10</count> </item> </produce>"

Here's the resulting array with the nodes that match <name></name>:

[ <name>Gala</name>, <name>Honeycrisp</name> ]

Example 2

Following example 1, this example finds nodes that match the <count></count> node and adds those node values with the sum() function:

xpath(xml(parameters('items')), 'sum(/produce/item/count)')

And returns the result 30.

year

Return the year of the specified timestamp.

year('<timestamp>')
Parameter Required Type Description
<timestamp> Yes string The string that contains the timestamp
Return value Type Description
<year> integer The year in the specified timestamp

Example

This example evaluates the timestamp for the year:

year('2018-03-15T00:00:00.000Z')

And it returns the result 2018.