Skip to main content
All CollectionsActions
Classic expression reference
Classic expression reference

Expressions are pieces of custom functionality which you can use in several places in your app, e.g. as an expression property in a model.

Betty Blocks avatar
Written by Betty Blocks
Updated over 11 months ago

Warning!

This is a legacy document. The features described below are only usable within the classic generation environment.


Classic expressions can not be directly connected to next-gen features, please consider using next-gen actions if you wish to use value calculations for your application.


Read this reference if you would like to know what kinds of expressions there are.

Use expressions in your actions to get specific and complex results you can not get from static data model properties.

Consider carefully when you use a property expression since an expression is triggered on every create and update. When there are too many expressions or the expression is triggered a lot of times, then it will hurt its performance. Furthermore, the expression’s output will not instantly be generated. If your actions rely on the expression’s output (for example in a PDF template), you might get some unexpected or blank results.

Good to know: every time an expression has to be calculated, the background jobs will be automatically paused. After finishing all the expressions, the background jobs will be continued.

Best practice

To get better performance and more flexibility, use one of the properties (without expression):

  • CHECKBOX

  • DATE

  • DATETIME

  • MINUTES

  • NUMBER

  • NUMBER WITH DECIMAL

  • PRICE

  • TEXT

Create an action with the trigger BEFORE SAVE or AFTER SAVE (dependent on which case). The action can calculate the expression and save the desired output every time a record is saved.

Note: We advise creating expressions in your action and assigning the value to your model object instead of creating expressions within your data model to keep the calculation speed to a minimum.

Basic operators

All basic mathematical operators can be used in expressions. Take a look below! If you want to use a variable in an expression, you can use var: followed by the name of the variable. In this example, we're using the variables a and b.

You can also use the words and - or instead of the operators & and |.

Also, you can use brackets ( ) in the same way you use brackets in mathematics. Note: The different results as between 2 + 2 * 2 = 6 and (2 + 2) * 2 = 8. This is the same for `var:a + var:a * var:a = 6 and (var:a + var:a) * var:a = 8`.

You can also use the words and - or instead of the operators & and |.

Also, you can use brackets ( ) in the same way you use brackets in mathematics. Note: The different results as between 2 + 2 * 2 = 6 and (2 + 2) * 2 = 8. This is the same for `var:a + var:a * var:a = 6 and (var:a + var:a) * var:a = 8`.

Below is an overview of all expressions in Betty Blocks, in alphabetical order.

any_blank? (array)

var:collection = ["Betty", "Blocks", ""]
any_blank?(var:collection) >>> true

var:collection = ["Betty", "Blocks", "Alkmaar"]
any_blank?(var:collection) >>> false

var:collection = []
any_blank?(var:collection) >>> false

Checks if there are blank values in the collection.

Returns true or false.

any_nil?(collection)

var:collection = ["Betty", "Blocks", nil]
any_nil?(var:collection) >>> true

var:collection = ["Betty", "Blocks", ""]
any_nil?(var:collection) >>> false

var:collection = []
any_nil?(var:collection) >>> true

Checks if there are nil values in the collection. Returns true or false.

Note: There's a difference between nil and "" (blank).

any_not_blank?(collection)

var:collection = ["Betty", "Blocks", ""]
any_not_blank?(var:collection) >>> true

var:collection = ["", "", ""]
any_not_blank?(var:collection) >>> false

var:collection = []
any_not_blank?(var:collection) >>> false

Checks if there are non-blank values in the collection.

Returns true or false.

any_not_nil? (collection)

var:collection = ["Betty", "Blocks", nil]
any_not_nil?(var:collection) >>> true

var:collection = ["Betty", "Blocks", ""]
any_not_nil?(var:collection) >>> true

var:collection = []
any_not_nil?(var:collection) >>> false

Checks if there are non-nil values in the collection.

Returns true or false.

any_starts_with? (collection, value)

var:collection = ["Betty", "Blocks", "Alkmaar"]
any_starts_with?(var:collection, "Alk") >>> true

var:collection = ["Betty", "Blocks", "Alkmaar"]
any_starts_with?(var:collection, "Atlan") >>> false

Checks if there's any objects starting with the value entered in the expression.

array[number]

var:collection = [ "a", "b", "c" ]

var:collection[1] >>> "b"

Returns the object/record corresponding to the number in an array/collection, where 0 is the first.

Note: Text values need to be quoted when used in variables, numeric values don't. Note the difference in [1, 2, 3] and ["a", "b", "c"]. Double or single quotes both suffice.

avg (array)

var:array = [1, 2, 3]
avg(var:array) >>> 2

Returns the average of an array of numbers.


base64_decode (value, format, extension)

var:base64 = base64_encode("test") >>> "dGVzdA=="

base64_decode(var:base64, "string")
>>> "test"

base64_decode(var:base64)
>>> file with random name and extension based on the input

base64_decode(var:base64, "file")
>>> file with random name and extension based on the input

base64_decode(var:base64, "file", "txt")
>>> file with random name and .txt extension

base64_decode(var:base64, "file", "custom_name.txt")
>>> file named 'custom_name.txt'

You can use this to decode a base64 text or a base64 file.
To assign to a file property, you'll need to do the decode expression in an URL expression.

The third parameter is considered to be a file with extension, when the name contains a ..

When decoding with the "file" option, a temporary file is generated. At the end of the action, this file is discarded. Make sure to assign it this file is required.

base64_encode (text/file)

base64_encode("test") >>> "dGVzdA=="
base64_encode(var:file)

base64_encode() lets you encode a file or text in base64 format. Base64 encoding is used in several web services, but is also a good way to transfer files.
Warning: We recommend the use of the base64 expression for the transfer of files. Be careful not to save files while encoded, as this may harm the load on your application.

beginning_of_month (date)

beginning_of_month(10-03-12 13:41) >>> 01-03-12

Returns the date of the first of the month from the given date.

blank? (record)

var:record.name = "Robert"

blank?(var:record.name) >>> false
blank?(var:record) >>> false

blank?(var:record) is the direct opposite of present?(var:record)

Checks if a record or variable exists. Returns false if the record or variable exists.

boolean_match (value, regex)

var:value = "Betty Blocks!"

boolean_match(var:value, "^[A-Za-z0-9 _.!]+$") >>> true
boolean_match(var:value, "^[A-Za-z0-9 _.]+$") >>> false

Checks if a value matches a Regex. Returns true or false.

business_days_offset (date, number_of_days)

business_days_offset(2019-04-10,6) >>> 2019-04-18

Returns a date which is the date + the given business days (/weekdays).

capitalize (string)

capitalize("betty blocks") >>> Betty blocks

Changes the first letter of a string to a capital.

ceil (number)

ceil(9.2) >>> 10
ceil(4.6) >>> 5

Returns the next highest integer value by rounding up value if necessary.

concat (array, string)

concat(["Betty","Blocks","Alkmaar"], " / ") >>> Betty / Blocks / Alkmaar

concat(var:employees.name, " | ") >>> Robert | Thom | Marcel

Combines the values of an array. The second parameter defines the addition between the values.

count (array)

Array

var:a = ["a", "b", "c", "d"]
count(var:a) >>> 4
count([1,2,3]) >>> 3

Hash

var:b = {a: 1, b: 2, c: 3}
count(var:b) >>> 3

String

var:c = "This is text"
count(var:c) >>> 12

Returns the number of items in an array and hash, or returns the number of characters in a string.

count_full_collection (collection)

All records: Robert, Marcel, Thomas, Jermel, Ralph, Chris

var:collection_with_limit_4 =
Robert / 3
Marcel / 6
Thomas / 9
Jermel / 12

count_full_collection(var:collection_with_limit_4) >>> 6

Count the number of records in a collection, ignoring the set limit, without rendering the full collection.

day (date/datetime)

day(2019-05-01) >>> 1
day(2019-05-20) >>> 20

Returns the day from a specific date as a number expression.

days (amount)

var:date = 2019-01-01
var:date + days(2) >>> 2019-01-03

Use an amount of days in a calculation.

days_offset (date, number)

days_offset(2019-04-10,10) >>> 2019-04-20

Returns a date, which is the date + the given days.

decode_jwt(algorithm, secret, jwt)

var:algorithm = "HS256"
var:secret = "secret"
var:jwt = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJiMDhmODZhZi0zNWRhLTQ4ZjItOGZhYi1jZWYzOTA0NjYwYmQifQ.-xN_h82PHVTCMA9vdoHrcZxH-x5mb11y1537t3rGzcM"

decode_jwt(var:algorithm, var:secret, var:jwt) >>> {"userId"=>"b08f86af-35da-48f2-8fab-cef3904660bd"}

Decodes a JSON Web Token.

downcase(string)

downcase("BETTY") >>> betty

Transforms all characters of a string to lowercase.

end_of_month(date/datetime)

end_of_month(10-03-19) >>> 31-03-19 00:00:00
end_of_month(10-03-19 13:41) >>> 31-03-19 23:59:59

Returns a new date representing the end of the month.

errors!(object)

var:object (description is required, but blank)

errors!(var:object) >>> {"description"=>[{"code"=>"is_required", "message"=>"is required", "property"=>:description}]}

Executes validations and returns the errors (if any) as a hash, in one go.

exclamation

!(true) >>> false

! is the logical NOT Operator. Use to inverse the logical state of its operand. If a condition is true, then logical NOT operator will make false.

extname(file)

var:file = avatar.png

extname(var:file) >>> png

Returns the extension of a file.


fetch(hash, key, default)

var:answers =
{
"1": "answer to question 1",
"2": "answer to question 2"
}

fetch(var:answers, "2", "Does not exist") >>> answer to question 2
fetch(var:answers, "3", "Does not exist") >>> Does not exist

Returns the value for a given hash and key, with an optional default in case the key does not exist for the hash.

float(string)

var:text = "2.5"
float(var:text) >>> 2.5

float("2,39") >>> 2.0

Transforms a string to a float (decimal number). Only accepts . as a decimal delimiter.

floor(number)

floor(9.2) >>> 9
floor(9.6) >>> 9

Returns the largest integer less than or equal to the given (decimal) value.

generate_jwt(algorithm, secret, payload)

var:algorithm = "HS256"
var:secret = "secret"
var:payload = "{"userId"=>"b08f86af-35da-48f2-8fab-cef3904660bd"}"

generate_jwt(var:algorithm, var:secret, var:payload) >>>
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJiMDhmODZhZi0zNWRhLTQ4ZjItOGZhYi1jZWYzOTA0NjYwYmQifQ.-xN_h82PHVTCMA9vdoHrcZxH-x5mb11y1537t3rGzcM

Generate a JSON Web Token.

generate_uuid()

generate_uuid() >>> f384e3ad-e6dd-4cc2-b6c9-4ad5ac5b9191

Generate a unique identifier following the UUID format. An example of when to use a UUID is when calling an external API via HTTP Request events, where the receiving API expects each request to have a unique identifier.

gethostbyname(domain)

gethostbyname("bettyblocks.com") >>> 37.46.139.160

gethostbyname("hubspot.com") >>> 104.16.253.5

Returns an IP address based on the given domain.

hash?(variable)

var:hash = { "a" : "1" , "b" : "2" , "c" : "3" }
hash?(var:hash) >>> true

var:no_hash = ["Betty", "Blocks"]
hash?(var:no_hash) >>> false

Checks if a variable can be parsed as a hash. Returns true or false.

hmac_sha256(text, secret)

hmac_sha256("Betty Blocks", "secret") >>> ec1d3a29ae219e55fa3c3a3055a25b6ba514e0acadcb1d198798dc48dc978a66

Creates a hmac_sha256 hash and requires two arguments: the string for which you want to calculate the digest and a secret key that must be included in the calculation. It is mainly used for authentication with external API connections. You can use it to create an encrypted password.

hmac_sha384(text, secret)

hmac_sha384("Betty Blocks", "secret") >>> 4b642d2c4b3ca8349714cfa4d8bed17570c94284e06e07889d9fe6b0c0c2cd9a37e91d684632803943535d149b582382

Creates a hmac_sha384 hash and requires two arguments: the string for which you want to calculate the digest and a secret key that must be included in the calculation. It is mainly used for authentication with external API connections. You can use it to create an encrypted password.

hmac_sha512(text, secret)

hmac_sha512("Betty Blocks", "secret") >>> 14dd565a61c4ac3aab353edae6f81dc9225c99a90f0e138bea494c359e3ee40cbf9f581ecc57205722e8d6ed22c0748d65685e98dcd90e3264b4392d4bdbed48

Creates a hmac_sha512 hash and requires two arguments: the string for which you want to calculate the digest and a secret key that must be included in the calculation. It is mainly used for authentication with external API connections. You can use it to create an encrypted password.

hours(amount)

2019-01-04 12:00 + hours(3) >>> 2019-01-04 15:00

Use an amount of hours in a calculation.

ifelse

record.price < 50.00 ? record.price + 5.00 : record.price >>> If record.price is below 50 then record.price + 5.00 Else record.price

A boolean expression replacement for IF ELSE.

ifnil(value, default)

var:value = "Betty Blocks"
ifnil(var:value, "Alkmaar") = "Betty Blocks"

var:no_value = nil
ifnil(var:no_value, "Alkmaar") = "Alkmaar"

A conditional statement constructor. ifnil evaluates its argument and branches and checks on nil values. If a nil value applies, the default value is rendered instead.

include?(array, object)

include?(['a', 'b', 'c'], 'b') >>> true

var:product = "Chocolate"
var:inventory = ["Apple", "Orange", "Banana", "Pear"]

include?(var:inventory, var:product) >>> false

Returns true if the given object is present in self.

int(value)

var:text = "10"
10 + int(var:text) >>> 20

Converts a text to an integer.

keys(hash)

var:answers =
{
"1": "answer to question 1",
"2": "answer to question 2"
}

keys(var:answers) >>> ["1", "2"]

Returns an array of all keys in the hash.

ljust(text, number_of_characters)

ljust("Betty", 10) >>> "Betty "

ljust("Betty", 7) >>> "Betty "

ljust("Betty", 3) >>> "Betty"

Adds a specific number of whitespaces right of a text value, so the width matches the number given in the expression.

localize(date)

var:date = 2019-03-01

locale = en-US
localize(var:date, '%A %e %B %Y')) >>> Friday 1 March 2019

locale = nl-NL
localize(var:date, '%A %e %B %Y')) >>> vrijdag 1 maart 2019

Returns a date value in the given format, based the application's locale.

math_sqr(number)

var:number = 10
math_sqr(var:number) >>> 100

Returns the square of the variable in the brackets.

math_sqrt(number)

var:number = 100
math_sqrt(var:number) >>> 10

Returns the squareroot of the variable in the brackets.

math_sin(number)

var:number = 1
math_sin(var:number) >>> 0.841471

Returns the sine of the variable in the brackets.

math_cos(number)

var:number = 1
math_cos(var:number) >>> 0.5403023

Returns the cosine of the variable in the brackets.

math_tan(number)

var:number = 1
math_tan(var:number) >>> 1.5574077

Returns the tangent of the variable in the brackets.

math_asin(number)

var:number = 0.8414709848078965
math_asin(var:number) >>> 1

Returns the arcsine of the variable in the brackets.

math_acos(number)

var:number = 0.5403023058681398
math_asin(var:number) >>> 1

Returns the arcosine of the variable in the brackets.

math_atan(number)

var:number = 1.557407724654902
math_atan(var:number) >>> 1

Returns the arctangent of the variable in the brackets.

math_atan2(number, number)

var:number1 = 3
var:number2 = 4
math_atan2(var:number1, var:number2) >>> 0.6435011

Returns the arctangent of the two variables in the brackets.

math_log(number)

var:number = 3
math_log(var:number) >>> 1.0986123

Returns the logarithm of the variable in the brackets.

math_log2(number)

var:number = 3
math_log2(var:number) >>> 1.5849625

Returns the logarithm with base 2 of the variable in the brackets.

math_log10(number)

var:number = 3
math_log10(var:number) >>> 0.4771213

Returns the logarithm with base 10 of the variable in the brackets.

math_abs(number)

var:number = -3.1415927
math_abs(var:number) >>> 3.1415927

Returns the absolute of the variable in the brackets.

math_deg_to_rad(number)

var:number = 45
math_deg_to_rad(var:number) >>> 0.7853982

Returns the radian number of the variable in the brackets.

math_rad_to_deg(number)

var:number = 0.7853981633974483
math_rad_to_deg(var:number) >>> 45

Returns the degrees of the variable in the brackets.

math_pi()

math_pi() >>> 3.141592653589793

Returns pi.

math_exp(number)

var:number = 3
math_exp(var:number) >>> 20.0855369

Returns the output of Euler by the power of given value(x) in the brackets. (e^x)

math_e()

math_e() >>> 2.718281828459045

Returns Euler.

max(array)

max([1,2,3]) >>> 3

var:array = [34,29,127,45]
max(var:array) >>> 127

Returns the highest number of an array of numbers.

md5(text)

md5("Betty Blocks") >> f6e8a2baa494d57bd9c8b053f1fba164

Creates an md5 hash of text.

Note: We do not recommend using this expression for encryption of sensitive data. It can still be used for other, none-cryptographic purposes, though. See MD5 for more information.

min(array)

min([1,2,3]) >>> 1

var:array = [34,29,127,45]
min(var:array) >>> 29

Returns the lowest number of an array of numbers.

minutes(amount)

2019-01-04 12:00 + minutes(30) >>> 2019-01-04 12:30

Use an amount of minutes in a calculation.

mmatch(value, regex, index_of_matched_value)

var:value = "[BB2019] Betty Blocks"
var:regex = "^\[BB([0-9]*)\]([a-zA-Z\s]*)$"

mmatch(var:value, var:regex, 0) >>> [BB2019] Betty Blocks
mmatch(var:value, var:regex, 1) >>> 2019
mmatch(var:value, var:regex, 2) >>> Betty Blocks

Returns the result of matching a text value against a regex, divided in groups ( ).

modulo(number, divider)

modulo(21, 5) = 1
modulo(47, 6.5) = 1.5

Returns the remainder after division of one number by another.

modulo_round(number, divider)

modulo_round(21, 5) = 25
modulo_round(10, 4) = 12

Rounds up the first value, so the modulus returns 0.

monday_of_week_number(year, weeknumber)

monday_of_week_number(2019, 1) >>> 2019-01-14

Returns the date of the monday of the given week and year

month(date/datetime)

month(2019-04-01) >>> 04

Returns the month from a specific date as a number expression.

months(amount)

2019-04-01 + months(3) >>> 2019-07-01

Use a number of months in a calculation.

newline

"Hello" + newline + "World" >> Hello \n World

Inserts a \n, resulting in continuing on a new line.

nil?(record)

nil?(var:record.email) >>> true

Checks if a fields value is empty. Returns true or false.

now

Date = 01-04-2019
Time = 10:00:00

now >>> 2019-04-01 10:00:00

Returns the current date and time as a date time expression.

num_weeks_between_dates(date, date)

var:date1 = 2019-04-01
var:date2 = 2019-04-22

num_weeks_between_dates(var:date1, var:date2) >>> 3

Returns the difference between given dates, in weeks.

num_weeks(year)

var:year = 2019

num_weeks(var:year) >>> 52

Returns the number of weeks in the given year.

only_numbers(string)

only_numbers("a7263s11") >>> 726311

Returns all numeric characters from a string.

parameterize(string)

parameterize("betty blocks") >>> betty-blocks

Transforms a string to a parameter, making it a URL-friendly value.

pow (value, power)

pow(5, 5) >>> 3125

Returns the outcome of var:a raised to the power of var:b

present? (variable)

var:record.name = "Robert"

present?(var:record) >>> true
present?(var.record.name) >>> true

present?(var:record) is exactly the same as !(blank?(var:record))

Checks if a record or variable exists. Returns true if the record or variable exists, returns false if not.

random (number)

random(8) >>> 6
random(8) >>> 3
random(8) >>> 1

Returns a random number between 0 and the given number.

random_hex (number)

random_hex(6) >>> bf66d1

Generates a random hexadecimal string. The number argument defines the number of characters used for the string.

random_hex (number)

random_hex(6) >>> bf66d1

Generates a random hexadecimal string. The number argument defines the number of characters used for the string.

read_file (text_based_file)

var:file = employees.txt

read_file(var:file) >>>
Employee ID;Name
1;Robert
2;Thomas
3;Ralph
4;Marcel
5;Jermel

Returns the content of a text-based file.

regex_replace (value, what_to_replace, replace_with_what)

regex_replace("Betty \n Blocks", "\n", "from the") >> Betty from the Blocks

Replace a certain value with a different value. You'll need this one to perform a replace on "unreadable characters" and anything with a backslash. These include newlines (\n), tabs (\t) and carriage returns (\r).

replace(value, what_to_replace, replace_with_what)

replace("Berry Blocks", "r", "t") >> Betty Blocks

Replace a certain value with a different value.

rjust(text, number_of_characters)

rjust("Betty", 10) >>> " Betty"

rjust("Betty", 7) >>> " Betty"

rjust("Betty", 3) >>> "Betty"

Adds a specific number of whitespaces left of a text value, so the width matches the number given in the expression.

round(number with decimal, number)

round(99.8) >>> 100
round(99.876, 2) >>> 99.88

Rounds a number with decimal to a whole number, or to a precision equal to the number given as second parameter.

rsa_decrypt (encrypted_text, private_rsa_key)

var:value =
WSbb0M51xG/ygqmKoAJg44r6M3io53nTsM5Rd6WV7u4SYXEbHy+33nH4TFKBECwdVwb9NyhevCAR/1x6pLuqHvRS6hgUqh69c19PhtCF216ZjakGz0kX+87L+QX4EqHh9QEHTzkoLMMj0/WwDhqt7/8pVUJXH5UripU6o5FpXsM=

var:private_key =
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQCB7QOk0GzoRHG5GnYFt3IwVaaQkE0uBrF/Cp80HiemSbh+edvS
iGbuZzGnoQDj+z2vq0TK+GL2IBrIlRUvyabo+cvYn3iZMmYCgmCRTsH12f+bqR4z
B04YLKp/5soj/ElDE8xymrSv/ITn8VSwsOL012zEDSTgdAOtGpydWYD0wwIDAQAB
AoGAYSAteSfWQkvoN9fwIpXgZwGgYrF9AMtAJRhrqypfuY+iu+mcyuXtDItYM1fI
sqU+l/QQmSrVz+hwHUJVdEPq4WFxqC8XsEGilk6MhNR50tUycM5I9y08WyXwklAs
c4WNywMDcvdE7yvINdoERXAfl1y6L7CFP2AqLNXfZyOSgQECQQD3Swdr5ho1RfT+
Aun19QCsWooufUq3WBRudXB6qKlpXsoavTlNu7mccHaI3NttWZoO2VtwEWZbaRzx
5XSKCGiFAkEAhoAZGSdRNTWqRXrQeb+K67xySlZNhrRBxCpmM3Pk/kIr99A81vbB
SDa2dF7r5d9DDwwR8T2ywJnTi3kjx0+OpwJBAL4W3YCSYyj6OoWbJc7b4wWZn0h3
JRzkRuhVu/19cqQ9qet98vOOzvGy/VrdMorO6n5plEEEDwNLPGWxNLD6H6UCQGu/
t1uVSdNMuKmMp/LA5fPQNecjmFvvkDgsl09k6vBd5odShUrYxyKo4iX73RN8dmZZ
jw4qFUeCdBxp4aXMMEUCQQDNO4e5HOljcyNpvvPRvmS7W6qtOyHILHiROMYHPA7U
v9EB2SpVGIYsEv5ZMZCJInYxuxNibc9EVSYTBficwY2k
-----END RSA PRIVATE KEY-----

var:public_key =
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCB7QOk0GzoRHG5GnYFt3IwVaaQ
kE0uBrF/Cp80HiemSbh+edvSiGbuZzGnoQDj+z2vq0TK+GL2IBrIlRUvyabo+cvY
n3iZMmYCgmCRTsH12f+bqR4zB04YLKp/5soj/ElDE8xymrSv/ITn8VSwsOL012zE
DSTgdAOtGpydWYD0wwIDAQAB
-----END PUBLIC KEY-----


rsa_encrypt(var:value, var:public_key) >>> Betty Blocks

Decrypts encrypted values into plain text through a private RSA-key.

rsa_encrypt (values, public_rsa_key)

var:value = Betty Blocks

var:private_key =
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQCB7QOk0GzoRHG5GnYFt3IwVaaQkE0uBrF/Cp80HiemSbh+edvS
iGbuZzGnoQDj+z2vq0TK+GL2IBrIlRUvyabo+cvYn3iZMmYCgmCRTsH12f+bqR4z
B04YLKp/5soj/ElDE8xymrSv/ITn8VSwsOL012zEDSTgdAOtGpydWYD0wwIDAQAB
AoGAYSAteSfWQkvoN9fwIpXgZwGgYrF9AMtAJRhrqypfuY+iu+mcyuXtDItYM1fI
sqU+l/QQmSrVz+hwHUJVdEPq4WFxqC8XsEGilk6MhNR50tUycM5I9y08WyXwklAs
c4WNywMDcvdE7yvINdoERXAfl1y6L7CFP2AqLNXfZyOSgQECQQD3Swdr5ho1RfT+
Aun19QCsWooufUq3WBRudXB6qKlpXsoavTlNu7mccHaI3NttWZoO2VtwEWZbaRzx
5XSKCGiFAkEAhoAZGSdRNTWqRXrQeb+K67xySlZNhrRBxCpmM3Pk/kIr99A81vbB
SDa2dF7r5d9DDwwR8T2ywJnTi3kjx0+OpwJBAL4W3YCSYyj6OoWbJc7b4wWZn0h3
JRzkRuhVu/19cqQ9qet98vOOzvGy/VrdMorO6n5plEEEDwNLPGWxNLD6H6UCQGu/
t1uVSdNMuKmMp/LA5fPQNecjmFvvkDgsl09k6vBd5odShUrYxyKo4iX73RN8dmZZ
jw4qFUeCdBxp4aXMMEUCQQDNO4e5HOljcyNpvvPRvmS7W6qtOyHILHiROMYHPA7U
v9EB2SpVGIYsEv5ZMZCJInYxuxNibc9EVSYTBficwY2k
-----END RSA PRIVATE KEY-----

var:public_key =
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCB7QOk0GzoRHG5GnYFt3IwVaaQ
kE0uBrF/Cp80HiemSbh+edvSiGbuZzGnoQDj+z2vq0TK+GL2IBrIlRUvyabo+cvY
n3iZMmYCgmCRTsH12f+bqR4zB04YLKp/5soj/ElDE8xymrSv/ITn8VSwsOL012zE
DSTgdAOtGpydWYD0wwIDAQAB
-----END PUBLIC KEY-----


rsa_encrypt(var:value, var:private_key) >>>
WSbb0M51xG/ygqmKoAJg44r6M3io53nTsM5Rd6WV7u4SYXEbHy+33nH4TFKBECwdVwb9NyhevCAR/1x6pLuqHvRS6hgUqh69c19PhtCF216ZjakGz0kX+87L+QX4EqHh9QEHTzkoLMMj0/WwDhqt7/8pVUJXH5UripU6o5FpXsM=

Encrypts values into an RSA Message through a public RSA-key.

The text to encrypt must be shorter than the RSA-key.

The maximum size for an RSA-key of 2048 bits is 2048 / 8 => 256 characters

sample (collection)

var:collection = ["Betty", "Blocks", "Alkmaar", "2019"]

sample(var:collection) >>> "Blocks"
sample(var:collection) >>> "2019"
sample(var:collection) >>> "Betty"

Returns a random object from the collection.

seconds (number)

2019-01-04 12:00:00 + seconds(200) >>> 2019-01-04 12:03:20

Use an amount of seconds in a calculation.

sha1 (text)

sha1("Betty Blocks") >>> b6a6208882a9ab2e097259a2534f7c126bbada4d

Creates a sha1 hash of text, using the SHA-1 encryption method.

sha256(text)

sha256("Betty Blocks") >>> 51588c6d5db3a3bcf1a323627f8f6839ed04bf781e5796a855719f7249e6a66c

Creates a sha256 hash of text, using the SHA-2 encryption method, using a 256-bit sized digest.

sha384 (text)

sha384("Betty Blocks") >>> 065e413175c0d0989d94982cea6193f7a2bed7acc6a693e0e4bcebc3d1dd7db084309e015f65d231f7539b812b56bb18

Creates a sha384 hash of text, using the SHA-2 encryption method, using a 384-bit sized digest.

sha512 (text)

sha512("Betty Blocks") >>> 619a52f61ccc91a59dbb162c4a203ca544ae02b06f81ba54cc3c055828ee747f48c911df9d9d35cef07264fcd35a610bf8fdfe141a80bb8d848e001469a6c4c0

Creates a sha512 hash of text, using the SHA-2 encryption method. using a 512-bit sized digest.

shuffle(collection)

var:collection = ["Robert", "Marcel", "Ralph", "Jermel"]

shuffle(var:collection) >>> ["Jermel", "Marcel", "Robert", "Ralph"]
shuffle(var:collection) >>> ["Marcel", "Jermel", "Ralph", "Robert"]
shuffle(var:collection) >>> ["Ralph", "Jermel", "Marcel", "Robert"]

Returns the collection in a random order.

slice (array, start, length)

var:array = ["a", "b", "c", "d", "e", "f"]
slice(var:array, 2, 3) >>> ["c", "d", "e"]

Slices an array/collection from the given start value, for the given length.

split(string, argument)

split("Betty Blocks Alkmaar", " ") >>> ["Betty", "Blocks", "Alkmaar"]

Returns an array after splitting a string on an argument/value.

squeeze (string)

squeeze("Betty Blocks Alkmaar") >>> Betty Blocks Alkmaar

Removes double whitespaces from a string.

starts_with? (string, string)

starts_with?("Betty", "Be") >>> true

starts_with?("Blocks", "Be") >>> false

Checks if a text value starts with the second given text value. Returns true or false.

str(value)

str(10) + str(10) >>> 1010

Converts a value to a string.

strftime (datetime, format)

strftime(2019-04-01T07:23:34, "%d/%m/%Y") >>> 01/04/2019

Creates a string based on a format applied to a datetime. Use this as a text expression.

Note: The return value of strftime with parameter %U (week of the year) returns the value 00 as the first week of the year and increases by 1 for every new week of the year.

Click here for all date formats.

string operators

"Betty" * 3 >>> "BettyBettyBetty"
"Betty" + "Blocks" >>> "BettyBlocks"

Some basic operators also work on strings. You can use a plus ( + ) to concatenate two strings and an asterisk/times ( * ) to repeat a string a number of times.

string_to_hash (string)

var:value = Betty Blocks

string_to_hash(var:value) >>> { "Betty Blocks" : null }

Transforms a string to a hash.

strip (string)

strip(" Betty Blocks ") >>> Betty Blocks

Removes all trailing whitespaces of a string.

substring (value, start, end)

substring("Betty Blocks", 5, 11) >>> Block

Returns characters from a selection of a string.

sum (array)

sum([1,2,3]) >> 6

var:collection = ["Betty","Blocks","Alkmaar"]

sum(var:collection) >>> BettyBlocksAlkmaar

Returns the sum of all the values in an array.

time_in_timezone (datetime, timezone)

var:date_time = 2019-04-01 10:20:00
time_in_timezone(var:date_time, "UTC") >> 2019-04-01 09:20:00

Returns the given timestamp in a different timezone.

to_json (text)

to_json('{[\"key\":\"123\"]}') >>> {["key" : "123"]}

Transforms text to JSON format.

today

Date = 2019-04-01 >>> today >>> 2019-04-01

Datetime = 2019-04-01 12:00:00 >>> today >>> 2019-04-01 00:00:00

Returns the current date as a date expression. If used as a date time expression, the time will be set to 00:00:00.

Warning: this expression is no longer functional in the data model expressions. this expression can only be used in action steps for the time being and will be phased out with the "today" time selecter in action expressions in the future.

transliterate (value)

transliterate("Bëtty Blöcks") >>> Betty Blocks
transliterate("Ærøskøbing") >>> AEroskobing

Transliterates UTF-8 characters to ASCII.

truncate (string, number_of_characters, trailing_text)

truncate("Betty Blocks", 8) >>> Betty…
truncate("Betty Blocks", 8, "~") >>> Betty B~

Shortens a string, closed by trailing text, based on the maximum number of characters. Maximum number includes the trailing text. By default, "..." is used as trailing text. By including a third parameter, you can choose your own trailing text.

uniq(array)

uniq([1,2,2,3]) >>> [1,2,3]

uniq(["Betty","Blocks","Alkmaar","Blocks"]) >>> ["Betty","Blocks","Alkmaar"]

Removes all double values in an array, returning only unique values.

upcase(string)

upcase("betty blocks") >>> BETTY BLOCKS

Transforms all the letters of a string to uppercase.

valid?(object)

var:employee = "employee": {
"name": "", <<< REQUIRED
"dob": "23-04-1994",
"is_manager": false,
"employee_id": 3
}

valid?(var:employee) >>> false

var:employee = "employee": {
"name": "Robert", <<< REQUIRED
"dob": "23-04-1994",
"is_manager": false,
"employee_id": 3
}

valid?(var:employee) >>> true

Checks if the record or custom model is valid.

values(hash)

var:answers =
{
"1": "answer to question 1",
"2": "answer to question 2"
}

values(var:answers) >>> ["answer to question 1", "answer to question 2"]

Returns a collection of all values in a hash.

working_days(date, date)

working_days(2019-04-01, 2019-04-09) >>>
[
"2019-04-01",
"2019-04-02",
"2019-04-03",
"2019-04-04",
"2019-04-05",
"2019-04-08",
"2019-04-09"
]

count(working_days(2019-04-01, 2019-04-09)) >>> 7

Calculates all working days between two days. Returns an array of dates.

weeks (amount)

2019-05-02 + weeks(2) >>> 2019-05-16

Use an amount of weeks in a calculation.

xml_to_json (xml)

var:xml =
<document>
<note>
<to>Robert</to>
<from>Marcel</from>
<heading>Betty Blocks!</heading>
<body>Wow! What a platform!</body>
</note>
</document>

xml_to_json(var:xml) >>>
{
"document": {
"note": {
"to": "Robert",
"from": "Marcel",
"heading": "Betty Blocks!",
"body": "Wow! What a platform!"
}
}
}

Transforms XML formatted text to JSON formatted text.

xpath (xml, path)

var:xml =
<document xmlns:soap="http://www.w3.org/2003/05/soap-envelope/">
<note>
<to>Robert</to>
<from>Marcel</from>
<heading>Betty Blocks!</heading>
<body>Wow! What a platform!</body>
</note>
</document>

xpath(var:xml, "/document/note/body", true) >>> <body>Wow! What a platform! </body>

xpath(var:xml, "/document/note/body/text()", true) >>> Wow! What a platform!

Returns the element(s) and their values of an XML formatted text. If you only want the value, append /text() to your path.

Add true to the expression to ignore any other attributes (like xmlns="value").

Note: Use tools like this xpath generator if you don't want to search for the precise path you need yourself.

year (date/datetime)

year(2012-05-01) >>> 2012

Returns the year from a specific date as a number expression.

years (amount)

today + years(2)

Give an amount of years for usage in a calculation.

Did this answer your question?