Expression Language reference
An expression comprises two main elements, functions and operators. These are then structured around brackets to create a custom formula:
[Functions]
- The part of the data that is to be operated on including profile attributes and constants. These are then processed using functions. Learn more here.[Operators]
- determine the action to be performed and can be arithmetic, logical, or a comparison. Learn more here.[Brackets]
- these determine the order of operations and allow for the grouping of functions and operators to build complex, custom formulas. Learn more here.
As an example, you could use a formula to calculate the conversion rate of an email campaign if you are capturing emails sent and emails clicked data. The custom formula would look something like this:
round(100\*(email_link_clicks/emails_sent),0)
Functions
A function is a pre-defined process that is run against constants and profile attributes to perform a complex task such as:
- Rounding or comparing numbers
- Formatting text or timestamps
- Date manipulation
You can use functions whenever you are building your formula in the web interface.
The following functions are available:
String functions
Len
The len
function returns the length of a string or profile attribute. This may be useful if you would like to evaluate if a string or profile attribute has an appropriate length.
Availability | Available in Moments and People |
---|---|
Format | len(stringValue) |
Input data type | String |
Output data type | Integer |
Example | len("infobip.com") Output: 11 |
Find
The find
function returns the position of a substring inside a string as a whole number. This is useful if you are looking to find a subset of data inside a string or profile attribute. This function is case sensitive.
find()
is zero-based (offset), meaning that it is indexed from 0. If the find()
function matches the entry at the beginning of a string then the output will be 0
.
Availability | Available in Moments and People |
---|---|
Format | find(stringValue, search) |
Input data type | String, String |
Output data type | Integer |
Example | The firstName attribute of a profile for a user called Andrea:find(First Name, "a") will output the number 5 for Andreafind(First Name, "A") will output 0 for Andrea.If no substring is matched using the find() function, then the output will be -1find(First Name, "b") will output -1 for Andrea |
Replace
The replace
function is a part of a string that contains an old value with a new value.
As a simple example, replace( "Good morning", "morning", "afternoon")
would output Good afternoon
.
Availability | Moments only |
---|---|
Format | replace(stringValue, oldValue, newValue) |
Input data type | String, String, String |
Output data type | String |
Example | replace( "I love cats", "cats", "dogs") Output: I love dogs |
Trim
The trim
function trims spaces, newlines, and tabs from both ends of a string.
Availability | Moments only |
---|---|
Format | trim(stringValue) |
Input data type | String |
Output data type | String |
Example | trim(" abc ") Output: abc |
Left
The left
function returns a count of the first characters from a string or profile attribute. This is useful if you want to return the first characters from a profile attribute or string of text.
For example, left(city ,4)
. If the city
attribute is London then the output would return the first 4 characters of London: Lond
.
Availability | Available in Moments and People |
---|---|
Format | left(stringValue, count) |
Input data type | String, Integer |
Output data type | String |
Example | left("I love cats",5) Output: I lov |
Right
The right
function returns a count of the last characters from a string or profile attribute. This is useful if you want to return the last characters from a profile attribute or string of text.
To use a simple example, right(city ,4)
. If the city
attribute is London then the output would return the last 4 characters of London: ndon
.
Availability | Available in Moments and People |
---|---|
Format | right(stringValue, count) |
Input data type | String, Integer |
Output data type | String |
Example | right("I love cats",4) Output: cats |
Mid
The mid
function returns a count of characters from a string or profile attribute starting from a chosen offset value. This is useful if you want to return the exact number of characters from the middle of a string or profile attribute.
This function is zero-based (offset), meaning that it is indexed from 0. Be sure to take this into account when you are defining the offset parameters to define where the count should start.
For example, mid(city,2,3)
. If the city
attribute is London then the output will be ndo
because offset is 2 and character count is 3.
Availability | Available in Moments and People |
---|---|
Format | mid(stringValue, offsetValue, countValue) |
Input data type | String, Integer, Integer |
Output data type | String |
Example | mid("I love cats",2,4) Output: love |
Concatenate
The concatenate
function returns the concatenated string. This is useful if you would like to combine multiple strings or profile attributes into a single output.
A simple example would be to combine a persons first name (firstName
attribute) and last name (lastName
attribute) into a single result if you ever need to capture their full name for marketing purposes.
Use concat(First Name, " ", Last Name)
for this example. If the firstName
attribute is Edward and lastName
attribute is Jones, then the output would be Edward Jones
.
Availability | Available in Moments and People |
---|---|
Format | concat(stringValue 1, stringValue 2, stringValue n...) |
Input data type | String, String, String, ... n; |
Output data type | String |
Example | concat("I", " Love ", "Cats") Output: I Love Cats |
Contains
The contain
function is a text search within a string (appears somewhere inside the string). Use contains()
to identify case sensitive text from within a larger body of text.
Availability | Moments only |
---|---|
Format | contains(stringValue, search) |
Input data type | String, String |
Output data type | Boolean |
Example | contains("CAT,dad,Frog,doggybag,hotdog","dog") Output: True contains("CAT,Frog,doggybag,hotdog","bird") Output: False |
Starts with
Use the startsWith()
function to determine whether a string starts with the characters of a particular string.
Availability | Moments only |
---|---|
Format | startsWith(stringValue, search) |
Input data type | String, String |
Output data type | Boolean |
Example | startsWith("Josephine","Jo") Output: True |
Ends with
Use the endsWith()
function to determine whether a string ends with the characters of a particular string.
Availability | Moments only |
---|---|
Format | endsWith(stringValue, search) |
Input data type | String, String |
Output data type | Boolean |
Example | endsWith("Josephine","Jo") Output : False |
leftPad
Use the leftPad
function to pad to the left of the original string with a padding string. The size integer specifies how many characters the new value should be, including the original string.
Availability | Moments only |
---|---|
Format | leftPad(original string, size integer, padding string) |
Input data type | String, Integer, String |
Output data type | String |
Example | leftPad("15", 6, "0") Output: 000015 leftPad("15", 7, "02") Output: 0202015 |
Date/Time functions
Now
Use the now()
function to return the current time (local) in the DateTime
format.
Availability | Moments only |
---|---|
Format | now() |
Input data type | - |
Output data type | DateTime |
Example | now() Output: YYYY-MM-DD THH:mm:ssZ ; e.g., 2009-09-24T11:34:56Z |
Today
Use the today()
function to return todays date (without time) in the Date
format by default. You can include the optional timezone parameter by adding following format to your expression:
+h
+hh
+hh:mm
-hh:mm
+hhmm
-hhmm
+hh:mm:ss
-hh:mm:ss
+hhmmss
-hhmmss
For example, today("-0600")
would set the timezone to -6 hours.
Availability | Moments only |
---|---|
Format | today() |
Input data type | - / String |
Output data type | Date |
Example |
YYYY-MM-DD |
Date add
Use addDays/addMonths
, etc., to add an integer amount to a date or time.
addHours
, addMinutes
, and addSeconds
operators output in Date Time
. Other addDate
operators output Date Time/Date
. You can subtract time by applying a minus integer in your expression.
For example, adddays(todatetime("2009-09-24","yyyy-MM-dd"), -4)
would output: 2009-09-20 00:00:00
Availability | Moments only |
---|---|
Format | addDays(dateTimeValue, amount), addHours(dateTimeValue, amount), addMinutes(dateTimeValue, amount), addSeconds(dateTimeValue, amount), addWeeks(dateTimeValue, amount), addMonths(dateTimeValue, amount), addQuarters(dateTimeValue, amount), addYears(dateTimeValue, amount) |
Input data type | DateTime or Date, Integer |
Output data type | DateTime or Date |
Example | addDays(toDate("2009-09-24", "yyyy-MM-dd"), 4) Output: 2009-09-28 addDays(toDate("2009-09-24", "yyyy-MM-dd"), -4) Output: 2009-09-20 |
Date diff
The dateDiff
function returns the difference between dt1
and dt2
date/datetime profile attributes as a decimal. The output result is in days by default.
You can set optional parameter modes to change the output to years, months, days, hours or seconds by including a string input.
This function is extremely powerful for calculating date differences relating to different events. Perhaps you would like to see the date difference between a user making a first order and when they completed last order or the date difference between purchase date and delivery date.
For example, dateDiff(firstOrderDate, lastOrderDate)
would return the difference in days between the two dates.
dateDiff(firstOrderDate, lastOrderDate, "hours")
would return the result in hours, and dateDiff(firstOrderDate, lastOrderDate, "minutes")
would return the result in minutes.
If you need the output to be a whole number, use the round()
function to round the decimal number.
Availability | Available in Moments and People |
---|---|
Format | dateDiff(dateValue 1, dateValue 2, [string]) |
Input data type | DateTime or Date, DateTime or Date, String |
Output data type | Decimal |
Example | dateDiff(toDateTime("2016-01-12 01:08:12", "yyyy-M-d HH:mm:ss") toDateTime("2017-01-12 01:08:12", "yyyy-M-d HH:mm:ss"), "years") Output: 1 dateDiff(toDate("2016-01-12", "yyyy-M-d") toDate("2016-01-11", "yyyy-M-d"), "hours") Output: 24 dateDiff(toDate("2016-01-12", "yyyy-M-d") toDateTime("2016-01-12 00:10:00", "yyyy-M-d HH:mm:ss")<br />"minutes") Output: 10 The toDate or toDateTime functions are not currently available for use in People. Use dateDiff with attributes like dateDiff(Purchase Date, Delivery Date) |
Year
The year
function returns the year for a dt
date/datetime profile attribute. This is useful if you would like to return only the year of a date/datetime profile attribute and then use it to create milestone marketing events around the year of birth.
For example, if the Birth Date
attribute is 04/12/1974
. year(Birth Date)
expression would output 1974
.
Availability | Available in Moments and People |
---|---|
Format | year(dateTimeValue) |
Input data type | DateTime or Date |
Output data type | Integer |
Example | year(toDate("1981-07-12", "yyyy-MM-dd")) Output: 1981 The toDate or to DateTime functions are not currently available for use in People. Use year with profile attributes like year(Birth Date) to show the year of birth. |
Quarter
The quarter
function returns the calendar quarter (1-4) for a dt
date/datetime profile attribute. This is useful if you would like to filter profile attributes by the calendar quarter (i.e., Q1 to Q4) and then target those profiles with particular marketing communications.
For example, if the purchaseDate
attribute is 04/12/2020
then the output of quarter (purchaseDate) would be 4
.
Availability | Available in Moments and People |
---|---|
Format | quarter(dateTimeValue) |
Input data type | DateTime or Date |
Output data type | Integer |
Example | quarter(toDate("1981-07-12", "yyyy-MM-dd")) Output: 3 The toDate or toDateTime functions are not currently available for use in People. Use quarter with profile attributes like quarter(Birth Date) to show which quarter the birthday falls on. |
Month
The month
function returns the month as a whole number (1-12) for a dt
date/datetime profile attribute.
For example, if a user's Birth Date
attribute is 04/12/1974
, then the expression month(Birth Date)
would output 12
.
Availability | Available in Moments and People |
---|---|
Format | month(dateTimeValue) |
Input data type | DateTime or Date |
Output data type | Integer |
Example | month(toDate("1981-07-12", "yyyy-MM-dd")) Output: 7 The toDate or toDateTime functions are not currently available for use in People. Use month with profile attributes like month(Birth Date) to show which month the birthday falls on. |
Day
Returns the day (1-31) for a dt
date/datetime profile attribute.
For example, if a user's Birth Date
attribute is 04/12/1974
, then the expression day(Birth Date)
would output 4
.
Availability | Available in Moments and People |
---|---|
Format | day(dateTimeValue) |
Input data type | DateTime or Date |
Output data type | Integer |
Example | day(toDate("1981-07-12", "yyyy-MM-dd")) Output: 12 The toDate or toDateTime functions are not currently available for use in People. Use day with profile attributes like day(Birth Date) to show which day the birthday falls on. |
Hour
The hour
function returns the hour part of a dt datetime
profile attribute. This is useful for delivery or purchase related profile attributes.
For example, if you have a profile attribute called deliveryDate
you could run the expression hour(deliveryDate)
to output the hour of delivery for a product or item.
If deliveryDate
is 2020-07-12 11:22:56
, then the output would be 11
.
Availability | Available in Moments and People |
---|---|
Format | hour(dateTimeValue) |
Input data type | DateTime |
Output data type | Integer |
Example | hour(toDateTime("1981-07-12 11:22:56", "yyyy-M-d HH:mm:ss")) Output: 11 The toDate or toDateTime functions are not currently available for use in People. Use hour with date and time attributes like hour(Last Purchase Date) to show which hour the purchase was made. |
Minute
The minute
function returns the minute of a given (date)time or profile attribute.
Availability | Moments only |
---|---|
Format | minute(dateTimeValue) |
Input data type | DateTime |
Output data type | Integer |
Example | minute(toDateTime("1981-07-12 12:34:56", "yyyy-M-d HH:mm:ss")) Output: 34 |
Second
The second
function returns the second of a given (date)time (or profile attribute).
Availability | Moments only |
---|---|
Format | second(dateTimeValue) |
Input data type | DateTime |
Output data type | Integer |
Example | second(toDateTime("1981-07-12 12:34:56", "yyyy-M-d HH:mm:ss")) Output: 56 |
Day of year
The dayofYear
function returns the day of the year for a dt date/datetime
profile attribute, where the count starts on January 1st and ends on the date set. This is useful for purchases or delivery related profile attributes and building campaigns around a particular day of the year, e.g., New Year's Day or Black Friday.
For example, if the purchaseDate
attribute is 2020-07-12 11:22:56
then the dayOfYear(purchaseDate)
output would be 193
.
Availability | Available in Moments and People |
---|---|
Format | dayOfYear(dateTimeValue) |
Input data type | DateTime or Date |
Output data type | Integer |
Example | dayOfYear(toDate("2021-10-12", "yyyy-M-d")) Output: 193 The toDate or toDateTime functions are not currently available for use in People. Use dayOfYear with date time attributes like dayOfYear(Last Purchase Date) to show which day of the year the last purchase was made. |
Day of week
The dayofWeek
function returns the day of the week (1-7) for the dt date/datetime
profile attribute, where Monday is 1 and Sunday is 7.
For example, if the deliveryDate
attribute is 2020-07-12 11:22:56
then the expression dayOfWeek(deliveryDate)
will be 3
.
Availability | Available in Moments and People |
---|---|
Format | dayOfWeek(dateTimeValue) |
Input data type | DateTime or Date |
Output data type | Integer |
Example | dayOfWeek(toDate("2021-10-12", "yyyy-M-d")) Output: 3 The toDate or toDateTime functions are not currently available for use in People. Use dayOfWeek with date time attributes like dayOfWeek(Last Purchase Date) to show which day of the week the last purchase was made. |
Format date time
The formatDateTime
function takes date time
as input and returns string with formatted date time
. The user setup requires a format specified as the second attribute, with support for unix format. Additional formats can be defined by the user based on masks and components.
- d: The day of the month, from 1 to 31.
- dd: The day of the month, from 01 to 31.
- eee: Day of the week abbreviated.
- eeee: The full name of the day of the week.
- h: The hour, 12-hour clock from 1 to 12.
- hh: The hour,12-hour clock from 01 to 12.
- H: The hour, 24-hour clock from 0 to 23.
- HH: The hour, 24-hour clock from 00 to 23.
- m: The minute, from 0 to 59.
- mm: The minute, from 00 to 59.
- M: The month, from 1 to 12.
- MM: The month, from 01 to 12.
- MMM: Name of the month abbreviated.
- MMMM: The full name of the month.
- s: The second, from 0 to 59.
- ss: The second, from 00 to 59.
- a: AM/PM designator.
- y: The year as a four-digit number.
- yy: The year, from 00 to 99.
- yyyy: The year as a four-digit number.
Availability | Moments only |
---|---|
Format | formatDateTime(dateTimeValue, formatValue) |
Input data type | DateTime or Date |
Output data type | Integer |
Example | formatDateTime(toDateTime("2021-08-03 14:05:13", "yyyy-M-d HH:mm:ss"), "unix") Output: 1627988713 formatDateTime(toDateTime("2021-08-03 14:05:13", "yyyy-M-d HH:mm:ss"), "dd-MM-yy h:mm a eee") Output: 03-08-21 2:05 PM Tue The toDate or toDateTime functions are not currently available for use in People. |
Format date
The formatDate
function takes date
as an input and returns a string with the date formatted according to the user's needs. The desired format needs to be added as a second attribute. The user can define other formats according to mask and components.
- d: The day of the month, from 1 to 31.
- dd: The day of the month, from 01 to 31.
- eee: The abbreviated name of the day of the week.
- eeee: The full name of the day of the week.
- M: The month, from 1 to 12.
- MM: The month, from 01 to 12.
- MMM: The abbreviated name of the month.
- MMMM: The full name of the month.
- y: The year as a four-digit number.
- yy: The year, from 00 to 99.
- yyyy: The year as a four-digit number.
Availability | Moments only |
---|---|
Format | formatDate(date, formatValue) |
Input data type | Date, String |
Output data type | String |
Example | formatDate(toDate("2007-04-05", "yyyy-MM-dd"), "dd.MM.yyyy") Output: 05.04.2007 formatDate(toDate("05/04/2007", "dd/MM/yyyy"), "yyyy-MM-dd") Output: 2007-04-05 The formatDate function is not currently available for use in People. |
Operators
You can use operators
to perform calculations and comparisons within custom formulas. This is very useful in scenarios if you would like to run calculations against values, e.g., adding up scores or counting the number of times a user has interacted with your service.
You can use the following operators:
- Arithmetic: Abs, +, -, /, *, Modulo %, Round, Floor
- Logical: AND, OR, NOT, >, <, >=, ==, !=
- Conversion: toInt, toDecimal, toDate, toTime, toDateTime, toString, toBool
- Other: generatePin
Arithmetic operators
Abs
Returns the absolute value of a given number or profile attribute.
For example, both abs(5)
and abs(-5)
functions would output 5
.
Availability | Available in Moments and People |
---|---|
Format | abs(decimalValue) |
Input data type | Decimal or Integer |
Output data type | Decimal or Integer (dependent on input data type) |
Example | abs(5) Output: 5 |
Add
Add values together using +
.
For example, the expression 1 + 2 + 3
would output 6
.
Availability | Available in Moments and People |
---|---|
Format | + |
Input data type | Decimal or Integer |
Output data type | Decimal or Integer (dependent on input data type) |
Example | 1 + 2 + 3 Output: 6 |
Subtract
Subtract values from another value using -
.
For example, the expression 5 - 3
would output 2
.
Availability | Available in Moments and People |
---|---|
Format | - |
Input data type | Decimal or Integer |
Output data type | Decimal or Integer (dependent on input data type) |
Example | 5 - 3 Output: 2 |
Divide
Divides values using /
.
For example, the expression 4 / 2
would output 2
.
Availability | Available in Moments and People |
---|---|
Format | / |
Input data type | Decimal or Integer |
Output data type | Decimal or Integer (dependent on input data type) |
Example | 4 / 2 Output: 2 |
Multiply
Multiplies values using \*
.
For example, the expression 2 \* 2
would output 4
.
Availability | Available in Moments and People |
---|---|
Format | x |
Input data type | Decimal or Integer |
Output data type | Decimal or Integer (dependent on input data type) |
Example | 2 * 2 Output: 4 |
Modulo
Returns the modulo
(remainder) of a divided value.
For example, the expression 12 % 8
would output 4
.
Availability | Available in Moments and People |
---|---|
Format | % |
Input data type | Decimal or Integer |
Output data type | Decimal or Integer (dependent on input data type) |
Example | 12 % 8 Output: 4 |
Round
Returns the value of num
rounded to the nearest value with digits after the decimal point. Scale the number of decimal points within the expression, and round to the nearest whole number.
For example, the expression round(1.23456, 3)
would round up to 3 decimal places. The result is 1.235
.
Availability | Available in Moments and People |
---|---|
Format | round(decimalValue, scale) |
Input data type | Decimal or Integer, Integer |
Output data type | Decimal or Integer (dependent on input data type) |
Example | round(1.23456,3) Output: 1.235 |
Floor
Returns the value of num
rounded down to the nearest integer value.
The expression floor(1.2345)
would output 1
.
Availability | Available in Moments and People |
---|---|
Format | floor(decimalValue) |
Input data type | Decimal or Integer |
Output data type | Decimal or Integer (dependent on input data type) |
Example | floor(1.2345) Output: 1 |
Ceil
Returns the value of num
rounded up to the nearest integer value.
The expression ceil(1.7)
would output 2
.
Availability | Available in Moments and People |
---|---|
Format | ceil(decimalValue) |
Input data type | Decimal or Integer |
Output data type | Decimal or Integer (dependent on input data type) |
Example | ceil(1.7) Output: 2 |
Logical operators
Equal
The ==
operator is used to evaluate if two values are equal and output True
or False
depending on the result.
As a simple example, 5 == 5
would output to True
and First Name == Last Name
would output to False
.
Availability | Available in Moments and People |
---|---|
Format | == |
Input data type | Any input data type |
Output data type | Boolean |
Example | A == A Output: True |
Not equal
The !=
operator is used to evaluate if two values are not equal, and output True
or False
depending on the result.
As a simple example, 5 != 5
would output to False
and First Name != Last Name
would output to True
.
Availability | Available in Moments and People |
---|---|
Format | != |
Input data type | Any input type |
Output data type | Boolean |
Example | "A" != "A" Output: False |
Greater than
The > operator is used to evaluate if a value is more than a different value and output True
or False
depending on the result.
As an example, 1 > 5 would output False
.
Availability | Available in Moments and People |
---|---|
Format | > |
Input data type | Decimal or Integer |
Output data type | Boolean |
Example | 1 > 5 Output: False |
Greater than or equal
The >= operator is used to evaluate if a value is more than or equal to another value, and output True
or False
depending on the result.
As an example, 1 >= 5 would output False
.
Availability | Available in Moments and People |
---|---|
Format | >= |
Input data type | Decimal or Integer |
Output data type | Boolean |
Example | 1 >= 5 Output: False |
Less than
The < operator is used to evaluate if a value is less than a different value, and output True
or False
depending on the result.
As an example, 1 < 5 would output True
.
Availability | Available in Moments and People |
---|---|
Format | < |
Input data type | Decimal or Integer |
Output data type | Boolean |
Example | 1 < 5 Output: True |
Less than or equal
The <= operator is used to evaluate if a value is less than or equal to another value, and output True
or False
depending on the result.
As an example, 1 <= 5 would output True
.
Availability | Available in Moments and People |
---|---|
Format | <= |
Input data type | Decimal or Integer |
Output data type | Boolean (True / False) |
Example | 1 <= 5 Output: True |
And
The and
operator returns True
if both operands are True
, and returns False
otherwise. This is a very effective way of creating complex custom formulas when used with brackets to order precedence.
For example, the expression (1==5) and (Gender=='m')
would output False
.
Availability | Available in Moments and People |
---|---|
Format | and |
Input data type | Boolean |
Output data type | Boolean |
Example | (1==5) and (3==4) Output: False |
Or
The or
operator returns False
if both operands are False
, and returns True
otherwise.
An example expression could be (5 ==5) or (Gender == "m")
which would output True
.
Availability | Available in Moments and People |
---|---|
Format | or |
Input data type | Boolean |
Output data type | Boolean |
Example | (5 ==5) or (3==4) Output: True |
Not
The not
operator is a Boolean operator that returns True
when the operand is False
, and returns False
when the operand is True
.
A simple example is not(5==5)
which would output False
.
Availability | Available in Moments and People |
---|---|
Format | not |
Input data type | Boolean |
Output data type | Boolean |
Example | not(5==5) Output: False |
If
The if
function evaluates the Boolean expression passed as its first parameter, and, depending on the result, returns option1
if true, or option2
if false.
Availability | Moments only |
---|---|
Format | if(predicate, option1, option2) |
Input data type | Boolean, option1 (data types: True/False/Date Time/Date/Decimal Number/Whole Number/Text), option2 (data types: True/False/Date Time/Date/Decimal Number/Whole Number/Text) |
Output data type | Output data type will be the same as the data type chosen at Input. |
Example | if(Gender == "M", "Mr", (if(MaritalState== "Married", "Mrs", "Ms")) Output: Value is Mr if gender is M Value is Mrs if gender is not M, and MaritalState is married. Value is Ms if gender is not M, and MaritalState is not married. |
isEmpty
The isEmpty
operator is a Boolean operator that returns true if an attribute/variable has no value, and returns false if an attribute/variable has a value.
Availability | Moments only |
---|---|
Format | isEmpty(any) |
Input data type | Any input data type |
Output data type | Boolean |
Example | isEmpty(BirthDate) Output: True , if no value exists for the attribute/variable |
Conversion operators
toInt
Converts a decimal, integer or string to integer.
Availability | Moments only |
---|---|
Format | toInt(decimalValue) |
Input data type | Decimal or Integer or String |
Output data type | Integer |
Example | toInt("123.345") Output: 123toInt(NULL) Output: 0 |
toDecimal
Converts a decimal, integer or string to decimal.
Availability | Moments only |
---|---|
Format | toDecimal( string text) |
Input data type | Decimal or Integer or String |
Output data type | Decimal |
Example | toDecimal("123.345") Output: 123.345 toDecimal(NULL) Output: 0 |
toDate
Converts a string to a date format.
Availability | Moments only |
---|---|
Format | toDate(stringValue, format) |
Input data type | String, String |
Output data type | Date |
Example | toDate("2009-09-24","yyyy-MM-dd") Output: 2009-09-24 |
toDateTime
Converts a string to a date time format.
Availability | Moments only |
---|---|
Format | toDateTime(stringValue, format) |
Input data type | String, String |
Output data type | DateTime |
Example | toDateTime("2009-09-24 12:34:56","yyyy-MM-dd HH:mm:ss") Output: 2009-09-24T11:34:56Z |
toString
Converts any input data type to a string.
Availability | Moments only |
---|---|
Format | toString(stringValue, format) |
Input data type | Any input data type |
Output data type | String |
Example | toString(123) Output: 123 |
toBool
Converts string text to a Boolean value.
Availability | Moments only |
---|---|
Format | toBool(booleanValue) |
Input data type | String |
Output data type | Boolean |
Example | toBool("TRUE") Output: True |
Other operators
Generate pin
Generates a random sequence of alphanumeric symbols.
Availability | Moments only |
---|---|
Format | generatePin(lengthValue, isAlphanumeric) |
Input data type | Integer, Boolean |
Output data type | String |
Example | generatePin(10,true) Output: ABCD43E5H4
6752 |
Brackets
You can use parentheses in complex, custom formulas to enforce the order of operators. This allows for the creation of highly complex formulas with limitless possibilities.