Help

Functions

When mapping items, you can use functions. The functions available in Integromat are similar to functions in Excel or those in other programming languages. The functions let you perform various changes to items, such as changing a bundle item to upper case, cutting selected text to a required size, converting a date into a different format, and many others. Functions are intended for advanced users.

Example: Cutting Tweet text

When writing a new Tweet, you should not exceed Twitter's 140-character limit. If you create a scenario with a Tweet containing more than the allotted amount, the scenario run will end with an error. If you map a text item that can contain more than 140 characters to be the source field for the Tweet, you may want to use the substring() function that will remove the extra characters that are over the limit.


Inserting a function into a field

Functions are inserted the same way as mapping items. By clicking a target field, it will open the mapping panel which is divided into several sections. You can switch between them by clicking them. The first section (shown upon opening the panel) displays the items that you can map from other modules. In the other sections, you will find different types of available functions.

To insert a function into a field, click the function name or drag it to the target field.


General functions

get(object or array; path)

Returns the value path of an object or array. To access nested objects, use dot notation. First item in an array is index 1.

get(array; 1+1)
get(array; 5.raw_name)
get(object; raw_name)
get(object; raw_name.sub_raw_name)

if(expression; value1; value2)

Returns value 1 if the expression is evaluated to true, otherwise it returns value 2.

if(1 = 1; A; B) 
= A
if(1 = 2; A; B) 
= B

ifempty(value1; value2)

Returns value 1 if this value is not empty, otherwise it returns value 2.

ifempty(A;B)
= A
ifempty(;B)
= B
ifempty("";B)
= B

switch(expression; value1; result1; [value2; result2; ...])

Evaluates one value (called the expression) against a list of values, and returns the result corresponding to the first matching value.

switch(B; A; 1; B; 2; C; 3) 
= 2
switch(C; A; 1; B; 2; C; 3) 
= 3

Text and binary functions

ascii(text; [remove diacritics])

Removes all non-ascii characters from a text string.

ascii(Iěnštčeřgžrýoámíaét) 
= Integromat
ascii(ěščřž; true) 
= escrz

base64(text)

Transforms text to base64.

base64(integromat) 
= aW50ZWdyb21hdA==

capitalize(text)

Converts first character in a text string to uppercase.

capitalize(integromat) 
= Integromat

decodeURL(text)

Decodes special characters in URL to text.

decodeURL(Automate%20your%20workflow) 
= Automate your workflow

encodeURL(text)

Encodes special characters in a text to a valid URL address.

escapeHTML(text)

Escapes all HTML tags in text.

escapeHTML(<b>Hello</b>) 
= &lt;b&gt;Hello&lt;/b&gt;

indexOf(string; value; [start])

Returns the position of the first occurrence of a specified value in a string. This method returns '-1' if the value searched for never occurs.

indexOf(Integromat; t) 
= 2
indexOf(Integromat; x) 
= -1
indexOf(Integromat; t; 3) 
= 9

lower (text)

Converts all alphabetical characters in a text string to lowercase.

lower(Hello)
= hello

md5(text)

Calculates the md5 hash of a string.

md5(integromat) 
= d155951844a40fb856108d803d4de33e

replace(text;search string; replacement string)

Replaces the search string with the new string.

replace(Hello World;Hello;Hi) 
= Hi World

sha1(text)

Calculates the sha1 hash of a string.

sha1(integromat) 
= 5572e727b5822e06d7d13c69f51b3addbfa5390f

split(text; separator)

Splits a string into an array of strings by separating the string into substrings.

split(John,George,Paul; ,)

stripHTML(text)

Removes all HTML tags from text.

stripHTML("<b>Hello</b>")
= Hello

substring(text; start;end)

Returns a portion of a text string between the "start" position and "the end" position.

substring(Hello;0;3) 
= Hel
substring(Hello;1;3)  
= el

toBinary(value)

Converts any value to binary data. You can also specify encoding as a second argument to apply binary conversions from hex or base64 to binary data.

toBinary(Integromat) 
= 496e746567726f6d6174
toBinary(SW50ZWdyb21hdA==; base64) 
= 496e746567726f6d6174

toString(value)

Converts any value to a string.

trim(text)

Removes space characters at the start or end of the text.

upper(text)

Converts all alphabetical characters in a text string to uppercase.

upper(Hello) 
= HELLO

Math functions

average([array of values]), average(value1; value2, ...)

Returns the average value of the numeric values in a specific array, or the average value of numerical values entered individually.

ceil(number)

Returns the smallest integer greater than or equal to a specified number.

ceil(1.2) 
= 2
ceil(4) 
= 4

floor(number)

Returns the largest integer less than or equal to a specified number.

floor(1.2) 
= 1
floor(1.9) 
= 1
floor(4) 
= 4

max([array of values]), max(value1;value2; ...)

Returns the largest number in a specified array, or the largest number among numbers entered individually.

min([array of values]), min(value1; value2; ...)

Returns the smallest number in a specified array, or the smallest number among numbers entered individually.

parseNumber(number; decimal separator)

Parses a string with a number and returns the number. Example: parseNumber(1 756,456;,)

round(number)

Rounds a numeric value to the nearest integer.

round(1.2) 
= 1
round(1.5) 
= 2
round(1.7) 
= 2
round(2) 
= 2

sum([array of values]), sum(value1; value2; ...)

Returns the sum of the values in a specified array, or the sum of numbers entered individually.

Date and time

addDays(date; number)

Returns a new date as a result of adding a given number of days to a date. To subtract days, enter a negative number.

addDays(2016-12-08T15:55:57.536Z; 2) 
= 2016-12-10T15:55:57.536Z
addDays(2016-12-08T15:55:57.536Z; -2) 
= 2016-12-6T15:55:57.536Z

addHours(date; number)

Returns a new date as a result of adding a given number of hours to a date. To subtract hours, enter a negative number.

addHours(2016-12-08T15:55:57.536Z; 2) 
= 2016-12-08T17:55:57.536Z
addHours(2016-12-08T15:55:57.536Z; -2) 
= 2016-12-08T13:55:57.536Z

addMinutes(date; number)

Returns a new date as a result of adding a given number of minutes to a date. To subtract minutes, enter a negative number.

addMinutes(2016-12-08T15:55:57.536Z; 2) 
= 2016-12-08T15:57:57.536Z
addMinutes(2016-12-08T15:55:57.536Z; -2) 
= 2016-12-08T15:53:57.536Z

addMonths(date; number)

Returns a new date as a result of adding a given number of months to a date. To subtract months, enter a negative number.

addMonths(2016-08-08T15:55:57.536Z; 2) 
= 2016-12-10T15:55:57.536Z
addMonths(2016-08-08T15:55:57.536Z; -2) 
= 2016-12-06T15:55:57.536Z

addSeconds(date; number)

Returns a new date as a result of adding a given number of seconds to a date. To subtract seconds, enter a negative number.

addSeconds(2016-12-08T15:55:57.536Z; 2) 
= 2016-12-08T15:55:59.536Z
addSeconds(2016-12-08T15:55:57.536Z; -2) 
= 2016-12-08T15:55:55.536Z

addYears(datum;years)

Returns a new date as a result of adding a given number of years to a date. To subtract years, enter a negative number.

addYears(2016-08-08T15:55:57.536Z; 2) 
= 2018-08-08T15:55:57.536Z
addYears(2016-08-08T15:55:57.536Z; -2) 
= 2014-08-08T15:55:57.536Z

formatDate(date; format; [timezone])

Returns a date in the requested format and optionally, in a specified timezone. For example, format DD.MM.YYYY HH:mm

formatDate(2016-12-28T16:03:06.372Z; MM/DD/YYYY)  
= 12/28/2016
formatDate(2016-12-28T16:03:06.372Z; YYYY-MM-DD hh:mm A)  
= 2016-12-28 4:03 PM
formatDate(2016-12-28T16:03:06.372Z; DD.MM.YYYY HH:mm; Europe/Prague)  
= 28.12.2016 17:03

parseDate(date; format; [timezone])

Parses a string with a date and returns the date.

parseDate(2016-12-28; YYYY-MM-DD) 
= 2016-12-28T00:00:00.000Z
parseDate(2016-12-28 16:03; YYYY-MM-DD HH:mm) 
= 2016-12-28T16:03:00.000Z
parseDate(2016-12-28 04:03 pm; YYYY-MM-DD hh:mm a) 
= 2016-12-28T16:03:06.000Z
parseDate(1482940986; X) 
= 2016-12-28T16:03:06.000Z

Functions for working with arrays

add(array; value1; value2; ...)

Adds values specified in parameters to an array and returns that array.

join(array; separator)

Concatenates all the items of an array into a string, using the specified separator between each item.

keys(object)

Returns an array of a given object's or array's properties.

map(complex array; key;[key for filtering];[possible values for filtering])

Returns a primitive array containing values of a complex array. Allows to filter values. Uses raw variable names for keys.

map(Emails[]; email) - returns a primitive array with emails
map(Emails[]; email; label; work; home) - returns a primitive array with emails having a label equal to work or home

remove(array; value1; value2; ...)

Removes values specified in the parameters of an array. Effective only on primitive arrays of text or numbers.

slice(array; start; [end])

Returns a new array containing only selected items.

Tokens for date/time parsing

Year, month, and day tokens

Input Example Description
YYYY 2014 4 or 2 digit year
YY 14 2 digit year
Y -25 Year with any number of digits and sign
Q 1..4 Quarter of year. Sets month to first month in quarter.
M MM 1..12 Month number
MMM MMMM Jan..December Month name
D DD 1..31 Day of month
Do 1st..31st Day of month with ordinal
DDD DDDD 1..365 Day of year
X 1410715640.579 Unix timestamp
x 1410715640579 Unix ms timestamp

Week year, week, and weekday tokens

Input Example Description
ddd dddd Mon...Sunday Day name
GGGG 2014 ISO 4 digit week year
GG 14 ISO 2 digit week year
W WW 1..53 ISO week of year
E 1..7 ISO day of week

Hour, minute, second, millisecond, and offset tokens

Input Example Description
H HH 0..23 Hours (24 hour time)
h hh 1..12 Hours (12 hour time used with a A.)
k kk 1..24 Hours (24 hour time from 1 to 24)
a A am pm Post or ante meridiem (Note the one character a p are also considered valid)
m mm 0..59 Minutes
s ss 0..59 Seconds
S SS SSS 0..999 Fractional seconds
Z ZZ +12:00 Offset from UTC as +-HH:mm, +-HHmm, or Z

Tokens for date/time formatting

Year, month, and day tokens

Token Output Description
YY 70 71 ... 29 30 2 digit year
YYYY 1970 1971 ... 2029 2030 4 digit year
Y 1970 1971 ... 9999 +10000 +10001 Year with any number of digits and sign
Q 1 2 3 4 Quarter of year
Qo 1st 2nd 3rd 4th Quarter of year with ordinal
M 1 2 ... 11 12 Month number
Mo 1st 2nd ... 11th 12th Month with ordinal
MM 01 02 ... 11 12 Month number with leading zero
MMM Jan Feb ... Nov Dec Month abbreviation
MMMM January February ... November December Month name
D 1 2 ... 30 31 Day of month
Do 1st 2nd ... 30th 31st Day of month with ordinal
DD 01 02 ... 30 31 Day of month with leading zero
DDD 1 2 ... 364 365 Day of year
DDDo 1st 2nd ... 364th 365th Day of year with ordinal
DDDD 001 002 ... 364 365 Day of year with leading zero

Week year, week, and weekday tokens

Token Output Description
d 0 1 ... 5 6 Day of week
do 0th 1st ... 5th 6th Day of week with ordinal
dd Su Mo ... Fr Sa Day abbreviation
ddd Sun Mon ... Fri Sat Day abbreviation
dddd Sunday Monday ... Friday Saturday Day name
E 1 2 ... 6 7 Day of week (ISO)
w 1 2 ... 52 53 Week of year
wo 1st 2nd ... 52nd 53rd Week of year with ordinal
ww 01 02 ... 52 53 Week of year with leading zero
W 1 2 ... 52 53 Week of year (ISO)
Wo 1st 2nd ... 52nd 53rd Week of year with ordinal (ISO)
WW 01 02 ... 52 53 Week of year with leading zero (ISO)
gg 70 71 ... 29 30 Week year
gggg 1970 1971 ... 2029 2030 Week year
GG 70 71 ... 29 30 Week year (ISO)
GGGG 1970 1971 ... 2029 2030 Week year (ISO)

Hour, minute, second, millisecond, and offset tokens

Token Output Description
H 0 1 ... 22 23 24 hour time
HH 00 01 ... 22 23 24 hour time with leading zero
h 1 2 ... 11 12 12 hour time
hh 01 02 ... 11 12 12 hour time with leading zero
k 1 2 ... 23 24 24 hour time
kk 01 02 ... 23 24 24 hour time with leading zero
A AM PM Post or ante meridiem (upper case)
a am pm Post or ante meridiem (lower case)
m 0 1 ... 58 59 Minutes
mm 00 01 ... 58 59 Minutes with leading zero
s 0 1 ... 58 59 Seconds
ss 00 01 ... 58 59 Seconds with leading zero
S 0 1 ... 8 9 Fractional seconds
SS 00 01 ... 98 99 Fractional seconds with leading zero
SSS 000 001 ... 998 999 Fractional seconds with two leading zeros
SSSS ... SSSSSSSSS 000[0..] 001[0..] ... 998[0..] 999[0..] Fractional seconds
Z -07:00 -06:00 ... +06:00 +07:00 Time zone
ZZ -0700 -0600 ... +0600 +0700 Time zone
X 1360013296 Unix Timestamp
x 1360013296123 Unix Millisecond Timestamp
Rate this article: