Share
Explore

icon picker
List of Operators


Operators
Category
Name
Description
1
List
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.
2
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.
3
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.
4
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.
5
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.
6
List
list.join(list, separator)
Returns a text with all list items separated by the separator.
7
List
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.
8
List
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.
9
List
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.
10
Logic
logic.and(a, b)
Returns TRUE if both a and b are truthy, otherwise FALSE.
11
Logic
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
12
Logic
logic.not(value)
Performs a logical negation. Returns TRUE if the given value is falsy, otherwise FALSE.
13
Logic
logic.or(a, b)
Returns TRUE if at least one of a or b are truthy, otherwise FALSE.
14
Logic
logic.xor(a, b)
Returns TRUE if either a or b are truthy, but not both. Otherwise FALSE.
15
Math
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
16
Math
math.add(a, b)
Returns the sum of two given numbers.
17
Math
math.div(dividend, divisor)
Returns the division of two given numbers.
Examples:
math.div(8, 4) => 2
math.div(5, 2) => 2.5
18
Math
math.mod(dividend, divisor)
Returns the remainder when dividing two numbers.
Examples:
math.mod(9, 2) => 1
math.mod(5, 3) => 2
19
Math
math.mul(a, b)
Returns the product of two given numbers.
20
Math
math.neg(a)
Returns the negated version of a number.
Examples:
math.neg(-5) => 5
math.neg(7) => -7
21
Math
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)
22
Math
math.sqrt(value)
Returns the square root of a number.
Examples:
math.sqrt(16) => 4
23
Math
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
24
Math
math.sub(a, b)
Returns the result when subtracting b from a.
25
Math
math.sum(list)
Returns the sum of a list of numbers.
Example:
math.sum(list.create(1,2,3)) => 6
26
Math
math.avg(list)
Returns the average of a list of numbers.
Example:
math.avg(list.create(1,2,3)) => 2
27
Math
math.min(list)
Returns the lowest number of a list of numbers.
Example:
math.min(list.create(1,2,3)) => 1
28
Math
math.max(list)
Returns the highest number of a list of numbers.
Example:
math.max(list.create(1,2,3)) => 3
29
Relation
relation.eq(a, b)
Compares two values and returns TRUE if they are equal, otherwise FALSE.
30
Relation
relation.gt(a, b)
Compares two values and returns TRUE if a is greater than b, otherwise FALSE.
31
Relation
relation.gte(a, b)
Compares two values and returns TRUE if a is greater than or equal to b, otherwise FALSE.
32
Relation
relation.lt(a, b)
Compares two values and returns TRUE if a is less than b, otherwise FALSE.
33
Relation
relation.lte(a, b)
Compares two values and returns TRUE if a is less than or equal to b, otherwise FALSE.
34
Relation
relation.ne(a, b)
Compares two values and returns TRUE if they are not equal, otherwise FALSE.
35
Object
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.
36
String
string.concat(a, b, ...)
Concatenates multiple strings.
Examples:
string.concat("hello", " you") => "hello you"
string.concat("a", "b", "c") => "abc"
37
String
string.contains(a, b)
Determines whether b is contained within a.
Examples:
string.contains("hello", "el") => TRUE
string.contains("hello", "what") => FALSE
38
String
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
39
String
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"]
40
String
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
41
String
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

Share
 
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.