Read this reference if you would like to know what kind of expressions there are. If you would like to know how to create expression properties in your data model, take a look at our tutorial article HowTo create expression properties?

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'd use brackets in mathematics. Please notice the difference 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.

All expressions you can use

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

any_blank?(array)

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

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

any_include?(collection, array)

Checks if value is present in the collection. Returns true or false.

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

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

any_nil?(collection)

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

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

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

any_not_blank?(collection)

Checks if there are non-blank values in the collection. Returns true or false.

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

any_not_nil?(collection)

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

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

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

any_starts_with?(collection, value)

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

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

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

array[number]

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

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

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

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)

Returns the average of an array of numbers.

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

base64_decode(value, format, extension)

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.

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'

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 will be generated. At the end of the action, this file will be discarded, so make sure to assign it if you need it.

base64_encode(text/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.

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

beginning_of_month(date)

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

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

blank?(record)

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

var:record.name = "Robert"

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

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

boolean_match(value, regex)

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

var:value = "Betty Blocks!"

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

business_days_offset(date, number_of_days)

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

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

capitalize(string)

Changes the first letter of a string to a capital.

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

ceil(number)

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

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

concat(array, string)

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

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

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

count(array)

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

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

count_full_collection(collection)

Count the number of records in a collection, ignoring the set limit, without rendering the full 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

day(date/datetime)

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

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

days(amount)

Use an amount of days in a calculation.

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

days_offset(date, number)

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

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

decode_jwt(algorithm, secret, jwt)

Decodes a JSON Web Token.

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"}

downcase(string)

Transforms all characters of a string to lowercase.

downcase("BETTY") >>> betty

end_of_month(date/datetime)

Returns a new date representing the end of the month.

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

errors!(object)

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

var:object (description is required, but blank)

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

exclamation

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

!(true) >>> false

extname(file)

Returns the extension of a file.

var:file = avatar.png

extname(var:file) >>> png

fetch(hash, key, default)

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

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

float(string)

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

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

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

floor(number)

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

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

generate_jwt(algorithm, secret, payload)

Generate a JSON Web Token.

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_uuid()

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.

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

gethostbyname(domain)

Returns an IP address based on the given domain.

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

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

hash?(variable)

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

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

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

hmac_sha256(text, secret)

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_sha256("Betty Blocks", "secret") >>> ec1d3a29ae219e55fa3c3a3055a25b6ba514e0acadcb1d198798dc48dc978a66

hmac_sha384(text, secret)

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_sha384("Betty Blocks", "secret") >>> 4b642d2c4b3ca8349714cfa4d8bed17570c94284e06e07889d9fe6b0c0c2cd9a37e91d684632803943535d149b582382

hmac_sha512(text, secret)

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.

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

hours(amount)

Use an amount of hours in a calculation.

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

ifelse

A boolean expression replacement for IF ELSE.

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

ifnil(value, default)

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.

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

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

include?(array, object)

Returns true if the given object is present in self.

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

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

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

int(value)

Converts a text to an integer.

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

keys(hash)

Returns an array of all keys in the hash. 

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

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

ljust(text, number_of_characters)

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

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

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

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

localize(date)

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

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

math_sqr(number)

Returns the square of the variable in the brackets.

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

math_sqrt(number)

Returns the squareroot of the variable in the brackets.

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

math_sin(number)

Returns the sine of the variable in the brackets.

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

math_cos(number)

Returns the cosine of the variable in the brackets.

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

math_tan(number)

Returns the tangent of the variable in the brackets.

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

math_asin(number)

Returns the arcsine of the variable in the brackets.

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

math_acos(number)

Returns the arcosine of the variable in the brackets.

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

math_atan(number)

Returns the arctangent of the variable in the brackets.

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

math_atan2(number, number)

Returns the arctangent of the two variables in the brackets.

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

math_log(number)

Returns the logarithm of the variable in the brackets.

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

math_log2(number)

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

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

math_log10(number)

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

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

math_abs(number)

Returns the absolute of the variable in the brackets.

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

math_deg_to_rad(number)

Returns the radian number of the variable in the brackets.

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

math_rad_to_deg(number)

Returns the degrees of the variable in the brackets.

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

math_pi()

Returns pi.

math_pi() >>> 3.141592653589793

math_exp(number)

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

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

math_e()

Returns Euler.

math_e() >>> 2.718281828459045

max(array)

Returns the highest number of an array of numbers.

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

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

md5(text)

Creates an md5 hash of text. 

md5("Betty Blocks") >> f6e8a2baa494d57bd9c8b053f1fba164

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)

Returns the lowest number of an array of numbers.

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

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

minutes(amount)

Use an amount of minutes in a calculation.

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

mmatch(value, regex, index_of_matched_value)

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

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

modulo(number, divider)

Returns the remainder after division of one number by another.

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

modulo_round(number, divider)

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

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

monday_of_week_number(year, weeknumber)

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

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

month(date/datetime)

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

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

months(amount)

Use a number of months in a calculation.

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

newline

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

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

nil?(record)

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

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

now

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

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

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

num_weeks_between_dates(date, date)

Returns the difference between given dates, in weeks.

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

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

num_weeks(year)

Returns the number of weeks in the given year.

var:year = 2019

num_weeks(var:year) >>> 52

only_numbers(string)

Returns all numeric characters from a string.

only_numbers("a7263s11") >>> 726311

parameterize(string)

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

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

pow(value, power)

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

pow(5, 5) >>> 3125

present?(variable)

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

var:record.name = "Robert"

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

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

random(number)

Returns a random number between 0 and the given number.

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

random_hex(number)

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

random_hex(6) >>> bf66d1

read_file(file)

Returns the content of a file.

var:file = employees.csv

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

regex_replace(value, what_to_replace, replace_with_what)

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

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

replace(value, what_to_replace, replace_with_what)

Replace a certain value with a different value. 

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

rjust(text, number_of_characters)

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

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

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

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

round(number with decimal, number)

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

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


rsa_decrypt(encrypted_text, private_rsa_key)

Decrypts encrypted values into plain text through a 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

rsa_encrypt(values, public_rsa_key)

Encrypts values into an RSA Message through a 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=

Due to how RSA works, the text to encrypt can't be longer than the RSA-key.

For an RSA-key of 2048 bits, the text has a maximum size of 2048 / 8 => 256 characters

sample(collection)

Returns a random object from the collection.

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

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

seconds(number)

Use an amount of seconds in a calculation.

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

sha1(text)

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

sha1("Betty Blocks") >>> b6a6208882a9ab2e097259a2534f7c126bbada4d

sha256(text)

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

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

sha384(text)

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

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

sha512(text)

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

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

shuffle(collection)

Returns the collection in a random order.

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"]

slice(array, start, length)

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

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

split(string, argument)

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

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

squeeze(string)

Removes double whitespaces from a string.

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

starts_with?(string, string)

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

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

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

str(value)

 Converts a value to a string.

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

strftime(datetime, format)

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

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

Click here for all date formats.

string operators

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.

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

string_to_hash(string) 

Transforms a string to a hash.

var:value = Betty Blocks

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

strip(string)

Removes all trailing whitespaces of a string.

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

substring(value, start, end)

Returns characters from a selection of a string.

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

sum(array)

Returns the sum of all the values in an array.

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

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

sum(var:collection) >>> BettyBlocksAlkmaar

time_in_timezone(datetime, timezone)

Returns the given timestamp in a different timezone.

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

to_json(text)

Transforms text to JSON format.

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

today

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

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

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

transliterate(value)

Transliterates UTF-8 characters to ASCII.

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

truncate(string, number_of_characters, trailing_text)

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.

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

uniq(array)

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

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

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

upcase(string)

Transforms all the letters of a string to uppercase.

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

valid?(object)

Checks if the record or custom model is valid.

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

values(hash)

Returns a collection of all values in a hash.

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

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

working_days(date, date)

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

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

weeks(amount)

Use an amount of weeks in a calculation.

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

xml_to_json(xml)

Transforms XML formatted text to JSON formatted text.

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!"
    }
  }
}

xpath(xml, path)

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").

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!

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

year(date/datetime)

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

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

years(amount)

Give an amount of years for usage in a calculation.

today + years(2)
Did this answer your question?