Expression language
Expression Language reference

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
  • Operators - determine the action to be performed and can be Arithmetic, Logical or a Comparison
  • Brackets - these determine the order of operations and allow for the grouping of functions and operators to build complex, custom formulas.

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 use functions whenever you are building your formula in the web interface.

You can use the following functions:

String functions

Len

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.
Formatlen(stringValue)
Input datatypeString
Output datatypeInteger
Examplelen("infobip.com") Output: 11

Find

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.

AvailabilityAvailable in Moments and People.
Formatfind(stringValue, search)
Input datatypeString, String
Output datatypeInteger
ExampleTo use a simple example using a firstName attribute of a profile for a user called Andrea:find(First Name, "a") will output the number for Andreafind(First Name, "A") will output for AndreaIf no substring is matched using the find() function then the output will be -1find(First Name, "b") will output -1 for Andrea

Replace

Replace 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

AvailabilityMoments Only
Formatreplace(stringValue, oldValue, newValue)
Input datatypeString, String, String
Output datatypeString
Examplereplace( "I love cats", "cats", "dogs")Output: I love dogs

Trim

Trims spaces, newlines and tabs from both ends of a string.

AvailabilityMoments Only 
Formattrim(stringValue)
Input datatypeString
Output datatypeString
Exampletrim(" abc ")Output: abc

Left

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.

To use a simple example, left(city ,4)

If the city attribute is London then the output would return the first 4 characters of London: Lond.

AvailabilityAvailable in Moments and People.
Formatleft(stringValue, count)
Input datatypeString, Integer
Output datatypeString
Exampleleft("I love cats",5)Output: I lov

Right

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.

AvailabilityAvailable in Moments and People.
Formatright(stringValue, count)
Input datatypeString, Integer
Output datatypeString
Exampleright("I love cats",4)Output: cats

Mid

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 an 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.

To use a simple 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.

AvailabilityAvailable in Moments and People.
Formatmid(stringValue, offsetValue, countValue)
Input datatypeString, Integer, Integer
Output datatypeString
Examplemid("I love cats",2,4)Output: love

Concatenate

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 First Name attribute is Edward and Last Name attribute is Jones. Then the output would be Edward Jones.

AvailabilityAvailable in Moments and People.
Formatconcat(stringValue 1, stringValue 2, stringValue n ...)
Input datatypeString, String, String, ... n 
Output datatypeString
Exampleconcat("I", " Love ", "Cats")Output: I Love Cats

Contains

Text search within a string (appears somewhere inside the string).

Use contains() to identify case sensitive text from within a larger body of text.

AvailabilityMoments only
Formatcontains(stringValue, search)
Input datatypeString, String
Output datatypeBoolean
Examplecontains("CAT,dad,Frog,doggybag,hotdog","dog")Output: Truecontains("CAT,Frog,doggybag,hotdog","bird")Output: False

Starts with

Use startsWith() to determine whether a string starts with the characters of a particular string.

AvailabilityMoments only
FormatstartsWith(stringValue, search)
Input datatypeString, String
Output datatypeBoolean
ExamplestartsWith("Josephine","Jo")Output: True

Ends with

Use endsWith() to determine whether a string ends with the characters of a particular string.

AvailabilityMoments only
FormatendsWith(stringValue, search)
Input datatypeString, String
Output datatypeBoolean
ExampleendsWith("Josephine","Jo")Output : False

leftPad

Use leftPad 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.

AvailabilityMoments only
FormatleftPad(original string, size integer, padding string)
Input datatypeString, Integer, String
Output datatypeString
ExampleleftPad("15", 6, "0")Output : 000015leftPad("15", 7, "02")Output: 0202015

Date / Time functions

Now

Use now() to return the current time (local) in DateTime format.

AvailabilityMoments only
Formatnow()
Input datatype-
Output datatypeDateTime
Examplenow()Output:  YYYY-MM-DD THH:mm:ssZi.e. 2009-09-24T11:34:56Z

Today

Use today() to return todays date (without time) in 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

AvailabilityMoments only
Formattoday()
Input datatype- / String
Output datatypeDate
Example

today()
today("+2")
today("-0230")
today("+02:30")

Output: YYYY-MM-DD

Date add

Use addDays/addMonths etc. to add an integer amount to a date or time.

addHours, addMinutes and addSeconds operators outputs in Date Time. Other addDate operators output Date Time/Date.

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

AvailabilityMoments only
FormataddDays(dateTimeValue, amount)addHours(dateTimeValue, amount)addMinutes(dateTimeValue, amount)addSeconds(dateTimeValue, amount)addWeeks(dateTimeValue, amount)addMonths(dateTimeValue, amount)addQuarters(dateTimeValue, amount)addYears(dateTimeValue, amount)
Input datatypeDateTime or Date, Integer
Output datatypeDateTime or Date
ExampleaddDays(toDate("2009-09-24", "yyyy-MM-dd"), 4)Output:  2009-09-28addDays(toDate("2009-09-24", "yyyy-MM-dd"), -4)Output: 2009-09-20

Date diff

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. For example, 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.

This can be done using the dateDiff() function.

For example, dateDiff(firstOrderDate, lastOrderDate) would return the uptput the difference in days.

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 round() function to round the decimal number.

AvailabilityAvailable in Moments and People
FormatdateDiff(dateValue 1, dateValue 2, [string])
Input datatypeDateTime or Date, DateTime or Date, String
Output datatypeDecimal
ExampledateDiff(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: 1dateDiff(toDate("2016-01-12", "yyyy-M-d"), toDate("2016-01-11", "yyyy-M-d"), "hours")Output: 24dateDiff(toDate("2016-01-12", "yyyy-M-d"), toDateTime("2016-01-12 00:10:00", "yyyy-M-d HH:mm:ss"), "minutes")Output: 10The toDate or toDateTime functions are not currently available for use in People.Use dateDiff with attributes like dateDiff(Purchase Date, Delivery Date). 

Year

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.

As a simple example if the Birth Date attribute is 04/12/1974

year(Birth Date) expression would output 1974

AvailabilityAvailable in Moments and People
Formatyear(dateTimeValue)
Input datatypeDateTime or Date
Output datatypeInteger
Exampleyear(toDate("1981-07-12", "yyyy-MM-dd"))Output: 1981The 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

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.

As a simple example, if the purchaseDate attribute is 04/12/2020 then the output of quarter(purchaseDate) would be 4

AvailabilityAvailable in Moments and People
Formatquarter(dateTimeValue)
Input datatypeDateTime or Date
Output datatypeInteger
Examplequarter(toDate("1981-07-12", "yyyy-MM-dd"))Output: 3The 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

Returns the month as a whole number (1-12) for a dt date/datetime profile attribute.

For example, if a user Birth Date attribute is 04/12/1974 then the expression month(Birth Date) would output 12

AvailabilityAvailable in Moments and People
Formatmonth(dateTimeValue)
Input datatypeDateTime or Date
Output datatypeInteger
Examplemonth(toDate("1981-07-12", "yyyy-MM-dd"))Output: 7The 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 Birth Date attribute is 04/12/1974 then the expression day(Birth Date) would output 4

AvailabilityAvailable in Moments and People
Formatday(dateTimeValue)
Input datatypeDateTime or Date
Output datatypeInteger
Exampleday(toDate("1981-07-12", "yyyy-MM-dd"))Output: 12The 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

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.

So if deliveryDate is 2020-07-12 11:22:56 then the output would be 11

AvailabilityAvailable in Moments and People
Formathour(dateTimeValue)
Input datatypeDateTime 
Output datatypeInteger
Example
hour(toDateTime("1981-07-12 11:22:56", "yyyy-M-d HH:mm:ss"))Output: 11The toDate or toDateTime functions are not currently available for use in People.Use hour with date time attributes like hour(Last Purchase Date) to show which hour the purchase was made.

Minute

Returns the minute of a given (date)time (or profile attribute)

AvailabilityMoments only
Formatminute(dateTimeValue)
Input datatypeDateTime 
Output datatypeInteger
Exampleminute(toDateTime("1981-07-12 12:34:56", "yyyy-M-d HH:mm:ss"))Output: 34

Second

Returns the second of a given (date)time (or profile attribute)

AvailabilityMoments only
Formatsecond(dateTimeValue)
Input datatypeDateTime 
Output datatypeInteger
Examplesecond(toDateTime("1981-07-12 12:34:56", "yyyy-M-d HH:mm:ss"))Output: 56

Day of year

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 i.e.  New Year's Day or Black Friday.

For example, if purchaseDate attribute is 2020-07-12 11:22:56 then the dayOfYear(purchaseDate) output would be 193

AvailabilityAvailable in Moments and People
FormatdayOfYear(dateTimeValue)
Input datatypeDateTime or Date
Output datatypeInteger
ExampledayOfYear(toDate("2021-10-12", "yyyy-M-d"))Output: 193The 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

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.

AvailabilityAvailable in Moments and People
FormatdayOfWeek(dateTimeValue)
Input datatypeDateTime or Date
Output datatypeInteger
ExampledayOfWeek(toDate("2021-10-12", "yyyy-M-d"))Output: 3The 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

Takes Date Time as input and returns string with formatted Date Time 
User setup needs format as a second attribute. unix format is supported.
Other types of format can be defined by user according to mask and components.

d: The day of the month, from 1 through 31.
dd: The day of the month, from 01 through 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 through 59.
mm: The minute, from 00 through 59.
M: The month, from 1 through 12.
MM: The month, from 01 through 12.
MMM: Name of the month abbreviated
MMMM: The full name of the month. 
s: The second, from 0 through 59.
ss: The second, from 00 through 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.

AvailabilityMoments only 
FormatformatDateTime(dateTimeValue, formatValue)
Input datatypeDateTime or Date
Output datatypeInteger
ExampleformatDateTime(toDateTime("2021-08-03 14:05:13", "yyyy-M-d HH:mm:ss"), "unix")Output: 1627988713formatDateTime(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 TueThe toDate or toDateTime functions are not currently available for use in People.

Format date

Takes Date as an input and returns a string with 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 through 31.
dd: The day of the month, from 01 through 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 through 12.
MM: The month, from 01 through 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.

AvailabilityMoments only 
FormatformatDate(date, formatValue)
Input datatypeDate, String
Output datatypeString
ExampleformatDate(toDate("2007-04-05", "yyyy-MM-dd"), "dd.MM.yyyy")Output: 05.04.2007formatDate(toDate("05/04/2007", "dd/MM/yyyy"), "yyyy-MM-dd")Output: 2007-04-05The 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 i.e. 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

AvailabilityAvailable in Moments and People
Formatabs(decimalValue)
Input datatypeDecimal or Integer
Output datatypeDecimal or Integer (dependent on input datatype)
Exampleabs(5)

Output: 5
abs(-5)

Output: 5

Add

Add values together using +

For example, the expression 1 + 2 + 3 would output 6

AvailabilityAvailable in Moments and People
Format+
Input datatypeDecimal or Integer
Output datatypeDecimal or Integer (dependent on input datatype)
Example1 + 2 + 3Output: 6

Subtract

Subtract values from another value using -

For example, the expression 5 - 3 would output 2

AvailabilityAvailable in Moments and People
Format-
Input datatypeDecimal or Integer
Output datatypeDecimal or Integer (dependent on input datatype)
Example5 - 3Output: 2

Divide

Divide values using /

For example, the expression  4 / 2 would output 2

AvailabilityAvailable in Moments and People
Format/
Input datatypeDecimal or Integer
Output datatypeDecimal or Integer (dependent on input datatype)
Example4 / 2Output: 2

Multiply

Multiply values using *

For example, the expression 2 * 2 would output 4

AvailabilityAvailable in Moments and People
Formatx
Input datatypeDecimal or Integer
Output datatypeDecimal or Integer (dependent on input datatype)
Example2 * 2Output: 4

Modulo

Return the modulo (remainder) of a divided value

For example, the expression 12 % 8 would output 4

AvailabilityAvailable in Moments and People
Format%
Input datatypeDecimal or Integer
Output datatypeDecimal or Integer (dependent on input datatype)
Example12 % 8Output: 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.

Round to the nearest whole number

For example, the expression round(1.23456, 3) would round up to 3 decimal places. So the result is 1.235

AvailabilityAvailable in Moments and People
Formatround(decimalValue, scale)
Input datatypeDecimal or Integer, Integer
Output datatypeDecimal or Integer (dependent on input datatype)
Exampleround(1.23456,3)Output: 1.235

Floor

Returns the value of num rounded down to the nearest integer value.

So the expression floor(1.2345) would output 1

AvailabilityAvailable in Moments and People
Formatfloor(decimalValue)
Input datatypeDecimal or Integer
Output datatypeDecimal or Integer (dependent on input datatype)
Examplefloor(1.2345)Output: 1

Ceil

Returns the value of num rounded up to the nearest integer value.

So the expression ceil(1.7) would output 2

AvailabilityAvailable in Moments and People
Formatceil(decimalValue)
Input datatypeDecimal or Integer
Output datatypeDecimal or Integer (dependent on input datatype)
Exampleceil(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.

AvailabilityAvailable in Moments and People
Format==
Input datatypeAny input dataype
Output datatypeBoolean
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.

AvailabilityAvailable in Moments and People
Format!=
Input datatypeAny input type
Output datatypeBoolean
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.

AvailabilityAvailable in Moments and People
Format>
Input datatypeDecimal or Integer
Output datatypeBoolean 
Example1 > 5Output: 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.

AvailabilityAvailable in Moments and People
Format>=
Input datatypeDecimal or Integer
Output datatypeBoolean
Example1 >= 5Output: 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.

AvailabilityAvailable in Moments and People
Format<
Input datatypeDecimal or Integer
Output datatypeBoolean
Example1 < 5Output: 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.

AvailabilityAvailable in Moments and People
Format<=
Input datatypeDecimal or Integer
Output datatypeBoolean (True / False)
Example1 <= 5Output: 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.

As a simple example, the expression (1==5) and (Gender=='m') would output False.

AvailabilityAvailable in Moments and People
Formatand
Input datatypeBoolean
Output datatypeBoolean
Example(1==5) and (3==4) Output: False

Or

The or operator returns False if both operands are False and returns True otherwise.

An examples expression could be (5 ==5) or (Gender == "m") which would output True.

AvailabilityAvailable in Moments and People
Formator
Input datatypeBoolean 
Output datatypeBoolean
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.

AvailabilityAvailable in Moments and People
Formatnot
Input datatypeBoolean
Output datatypeBoolean
Examplenot(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.

AvailabilityMoments only
Formatif(predicate, option1, option2)
Input datatypeBoolean, option1 (datatypes: True/False/Date Time/Date/Decimal Number/Whole Number/Text), option2 (datatypes: True/False/Date Time/Date/Decimal Number/Whole Number/Text)
Output datatypeOutput datatype will be the same as the datatype chosen at Input.
Exampleif(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 marrried.

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.

AvailabilityMoments only
FormatisEmpty(any)
Input datatypeAny input datatype
Output datatypeBoolean
ExampleisEmpty(BirthDate)Output: True if no value exists for the attribute/variable

Conversion operators

toInt

Convert a decimal, integer or string to integer.

AvailabilityMoments only
FormattoInt(decimalValue)
Input datatypeDecimal or Integer or String
Output datatypeInteger
ExampletoInt("123.345")Output: 123toInt(NULL)Output: 0

toDecimal

Convert a decimal, integer or string to decimal.

AvailabilityMoments only
FormattoDecimal( string text)
Input datatypeDecimal or Integer or String
Output datatypeDecimal
ExampletoDecimal("123.345")Output: 123.345toDecimal(NULL)Output: 0

toDate

Convert a string to a date format

AvailabilityMoments only
FormattoDate(stringValue, format)
Input datatypeString, String
Output datatypeDate
ExampletoDate("2009-09-24","yyyy-MM-dd")Output: 2009-09-24

toDateTime

Convert a string to a date time format.

AvailabilityMoments only
FormattoDateTime(stringValue, format)
Input datatypeString, String
Output datatypeDateTime
ExampletoDateTime("2009-09-24 12:34:56","yyyy-MM-dd HH:mm:ss")Output:  2009-09-24T11:34:56Z

toString

Convert any input datatype to a string.

AvailabilityMoments only
FormattoString(stringValue, format)
Input datatypeAny input datatype
Output datatypeString
ExampletoString(123)Output: "123"

toBool

Convert string text to a boolean value.

AvailabilityMoments only
FormattoBool(booleanValue)
Input datatypeString
Output datatypeBoolean
ExampletoBool("TRUE")Output: True

Other operators

Generate pin

Generate a random sequence of alphanumeric symbols.

AvailabilityMoments only
FormatgeneratePin(lengthValue, isAlphanumeric)
Input datatypeInteger, Boolean
Output datatypeString
ExamplegeneratePin(10,true)Output: ABCD43E5H4


generatePin(4,false)

Output: 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.

Need assistance

Explore Infobip tutorials

Encountering issues

Contact our support

What's new? Check out

Release notes

Unsure about a term? See

Glossary

Research panel

Help shape the future of our products
Service Terms & ConditionsPrivacy policyTerms of use