Formulas

In an you can apply Formulas to extract, format or process your data as they flow in the workflow. It’s as same as working with a spreadsheet software such as MS Excel, where you use formulas (built-in functions)) like sum(…), power(…), concatenate(…) …etc. In the same way, you can use formulas in that performs following functionalities.

  • Concatenate first & last name to create full name. e.g. contact({{#firstName}}, {{#lastName}}). Here {{#firstName}} & {{#lastName}} are two macros that resolve into firstName & lastName values that comes from the previous step of your ICApp each time it’s executed.
  • When using email as an action, you can add date & time to your email content to specify date(), time() functions.

String Functions

Function Description
to_lower( s ) Convert a string to lower case
to_upper( s ) Convert a string to upper case
to_caps( s ) Capitalize a string
trim( s ) Remove leading and trailing white spaces from a string
to_str( s ) Convert Numbers, JSON, Boolean values to their string form
is_empty( s ) Check if a string is empty
length( s ) Returns length of the string
compare( s1, s2) Compares two strings s1 & s2 lexicographically (alphabetical order of the dictionary). returns 0 => if equals, 1 => if s1 > s2, -1 => if s1 < s2
equals( s1, s2) Compares if s1 & s2 are exactly matches. Match is case sensitive.
concat( s1, s2) Concatenate two strings
contains( s, search) Check if the string contains the specified ‘search’ strings
matches( s, regex) Check if the string matches the given regex
mstart( s, prefix) Check if a string starts with the given prefix
mend( s, suffix) Check if a string ends with the given suffix
substr( s, start, end) Get a substring from start index to end index, note that first character of the string is at 0th index.
extract( s, regex) Extract all matching strings, for a given regex, in the string given as first argument to the function and produce the results as a json array
replace( s, what, rep) Replace ALL the occurrences of what found in the given string with the rep string
replace_rx( s, regex, rep) Replace ALL the occurrences that matches with the given regex, found in the given string, with the rep string

Date Functions

All date & time functions (unless you specify a timezone) uses UTC to avoid any regional differences.

Function Description
date() Today’s date as at UTC
time() Time as at UTC
time24h() Time as at UTC in 24h format
datetime() Date & time as at UTC
timestamp() Timestamp in number of seconds from the epoch of 1970-01-01T00:00:00Z
date_at( ) Today’s date at a given timezone
time_at( ) Time at a given timezone
datetime_at( ) Date & time at a given timezone
to_datetime( ) Convert ISO date time string to a format suitable for processing
ex_date( ) Extract date from ISO format
ex_time( ) Extract time from ISO format

Math Functions

Function Description
abs( ) Get absolute value of a Number
ceiling( ) Get the least integer number greater than or equal to the given number
floor( ) Get the greatest integer less than or equal to the given number
max( x, y) Get the greater of the two values x & y
min( x, y) Get the smallest of the two values x & y
pow( x, y) Get x value raised to the power of y value
round( ) Get rounding off value for the given argument
sum( x, y) Get summation of two x & y
to_num( ) Convert string value to it’s number format number

Other Functions

Function Description
to_json( ) Convert JSON to a it’s string form - i.e. stringify
base64( ) Generate Base 64 value of a given string
uuid() Generate random UUID.
url_enc( ) Encode a given URL fragment to a URL safe form
md5( ) Generate MD5 value of a given string




Regular Expressions Reference

x       The character x
xy      The character x followed by y and so on...
.       Match any single character except newline. When in [] class (see below) it means period.
-       Range in a Character class e.g. [a-z] or [0-9]
[]      Character class. e.g.
            [abc]       a, b, or c (simple class)
            [^abc]      Any character except a, b, or c (negation)
            [a-zA-Z]    a through z or A through Z, inclusive (range)
            [0-9]       0 through 9, inclusive (range)

\       Escape the next character.  e.g. \\ The backslash character
^       The beginning of a line. 
$       The end of a line. 
|       Alternation e.g. x|y  means either x or y.
()      Grouping 
*       0 or more times
+       1 or more times
?       0 or 1 times
{n}     exactly n number of times
{n,}    at least n times
{n,m}   at least n but not more than m times

\d	A digit: [0-9]
\D	A non-digit: [^0-9]
\s	A whitespace character: [\t\n\f\r]
\S	A non-whitespace character: [^\s]
\w	A word character: [a-zA-Z_0-9]
\W	A non-word character: [^\w]
Last modified September 21, 2024