Skip to content
Share
Explore

List of Operators


Operators
Category
Name
Description
list.firstItem(list)
Returns the first item of the given list or table. If list is empty, returns undefined.
Gives an error if list is not actually a list.
list.getItem(list, index)
Returns the item at the specified index (starting at 0) of the given list or table. If there is no item at the given position, returns undefined.
Example: list.getItem(/googleAds-1234, 0) gives you the first element at the given list.
Gives an error if list is not actually a list.
list.isEmpty(list)
Returns TRUE if the given list or table has at least one element, otherwise FALSE.
Gives an error if list is not actually a list.
list.lastItem(list)
Returns the last item of the given list or table. If list is empty, returns undefined.
Gives an error if list is not actually a list.
list.length(list)
Returns the amount of items in a given list or table.
Gives an error if list is not actually a list.
list.join(list, separator)
Returns a text with all list items separated by the separator.
list.create(item1, item2, ...)
Creates a list from the given items. Can accept zero or more items as parameters, and will output them as a list.
Example:
list.create(5,2,3) will output a list with the values 5, 2 and 3.
list.concat(list1, list2, ...)
Merges together multiple lists. Can accept zero or more lists as parameters, and will output them together as a single list.
Example:
Let’s say /report1 and /report2 output lists of values, then:
list.concat(/report1, /report2)
will output a single list with all the values of the two reports combined.
list.flatten(listOfLists)
Expects a single list as a parameter, where each item in the list is another list. This operator will then merge all lists together and return them as one list of items.
Example:
list.flatten(list.create(list.create(1,2), list.create(3,4)))
will output a single list with the values 1, 2, 3 and 4.
logic.and(a, b)
Returns TRUE if both a and b are truthy, otherwise FALSE.
logic.implies(a, b)
Performs a logical implication.
Examples:
logic.implies(FALSE, FALSE) => TRUE
logic.implies(FALSE, TRUE) => TRUE
logic.implies(TRUE, FALSE) => FALSE
logic.implies(TRUE, TRUE) => TRUE
logic.not(value)
Performs a logical negation.
Returns TRUE if the given value is falsy, otherwise FALSE.
logic.or(a, b)
Returns TRUE if at least one of a or b are truthy, otherwise FALSE.
logic.xor(a, b)
Returns TRUE if either a or b are truthy, but not both. Otherwise FALSE.
math.abs(value)
Returns the absolute value of a given number, meaning the sign is removed.
Examples:
math.abs(-5) => 5
math.abs(0) => 0
math.abs(7) => 7
math.add(a, b)
Returns the sum of two given numbers.
math.div(dividend, divisor)
Returns the division of two given numbers.
Examples:
math.div(8, 4) => 2
math.div(5, 2) => 2.5
math.mod(dividend, divisor)
Returns the remainder when dividing two numbers.
Examples:
math.mod(9, 2) => 1
math.mod(5, 3) => 2
math.mul(a, b)
Returns the product of two given numbers.
math.neg(a)
Returns the negated version of a number.
Examples:
math.neg(-5) => 5
math.neg(7) => -7
math.pow(a, b)
Returns the power of two numbers.
Examples:
math.pow(4, 2) => 16 (4 squared)
math.pow(5, 3) => 125 (5 cubed)
math.pow(125, math.div(1, 3)) => 5 (cube root of 125)
math.sqrt(value)
Returns the square root of a number.
Examples:
math.sqrt(16) => 4
math.round(number, decimals)
Rounds the given number to the given amount of decimal places.
Examples:
math.round(1.234, 0) => 1
math.round(1.234, 1) => 1.2
math.sub(a, b)
Returns the result when subtracting b from a.
math.sum(list)
Returns the sum of a list of numbers.
Example:
math.sum(list.create(1,2,3)) => 6
math.avg(list)
Returns the average of a list of numbers.
Example:
math.avg(list.create(1,2,3)) => 2
math.min(list)
Returns the lowest number of a list of numbers.
Example:
math.min(list.create(1,2,3)) => 1
math.max(list)
Returns the highest number of a list of numbers.
Example:
math.max(list.create(1,2,3)) => 3
relation.eq(a, b)
Compares two values and returns TRUE if they are equal, otherwise FALSE.
relation.gt(a, b)
Compares two values and returns TRUE if a is greater than b, otherwise FALSE.
relation.gte(a, b)
Compares two values and returns TRUE if a is greater than or equal to b, otherwise FALSE.
relation.lt(a, b)
Compares two values and returns TRUE if a is less than b, otherwise FALSE.
relation.lte(a, b)
Compares two values and returns TRUE if a is less than or equal to b, otherwise FALSE.
relation.ne(a, b)
Compares two values and returns TRUE if they are not equal, otherwise FALSE.
object.create(key1, value1, key2, value2, ...)
Accepts keys and values for an object that will be created. There must be an even amount of parameters, starting with the first key, followed by the first value, then the second key followed by the value for that key, and so on.
Example:
object.create("name", "Cat", "size", "Small", "favoriteNumber", 42)
This will create an object that has three attributes: name, size and favoriteNumber. These attributes have the respective values “Cat”, “Small” and 42.
string.concat(a, b, ...)
Concatenates multiple strings.
Examples:
string.concat("hello", " you") => "hello you"
string.concat("a", "b", "c") => "abc"
string.contains(a, b)
Determines whether b is contained within a.
Examples:
string.contains("hello", "el") => TRUE
string.contains("hello", "what") => FALSE
string.endsWith(a, b)
Determines whether the string a ends with the string b.
Examples:
string.endsWith("hello", "lo") => TRUE
string.endsWith("hello", "el") => FALSE
string.split(string, separator)
Splits up a given string into multiple strings, separated with a given separator. If the separator is an empty string, the split will occur after each character.
Examples:
string.split("hey, a, test", ", ") => ["hey", "a", "test"]
string.split("hey", "") => ["h", "e", "y"]
string.startsWith(a, b)
Determines whether the string a starts with the string b.
Examples:
string.startsWith("hello", "hel") => TRUE
string.startsWith("hello", "el") => FALSE
string.from(value)
Converts a given value into a string representation via. JSON.
Examples:
Expression:
string.from("hey")
Output:
"hey"

Expression:
string.from(42)
Output:
42

Expression:
string.from(object.create("a", 1))
Output:
{
"a": 1
}

Expression:
string.from(list.create(1,2,3))
Output:
[
1,
2,
3
]
There are no rows in this table

Want to print your doc?
This is not the way.
Try clicking the ··· in the right corner or using a keyboard shortcut (
CtrlP
) instead.