Logic Functions
Mappings: Functions and Expressions · Updated June 12, 2025
And
Description
- Returns TRUE if all the provided arguments are logically true, and FALSE if any of the provided arguments are logically false. This will apply to all elements of a list in the first position.
ℹ️ This function is often used within IF functions.
Syntax
AND(logical_expression_1, [logical_expression_2, ...])
-
0is logicallyFALSE -
All other numbers (including negative numbers) are logically
TRUE
Examples
-
AND(true,true)returnsTRUE -
AND(true,false)returnsFALSE -
AND(0,1)returnsFALSE
Apply
Description
- Applies the parameters as arguments to the function (lambda) provided.
- Apply is a Lambda Helper function that can be used in conjunction with a Lambda functions.
Syntax
APPLY(LAMBDA, value, [value, ...]
-
Alternatively, the Lambda function could be written as an expression with the name
eachas seen below.- This is useful when calling all instances of a repeated attribute in source data. Typically, the
eachwill be referenced in a Lambda Helper Function that supplies more information regarding the variable.
- This is useful when calling all instances of a repeated attribute in source data. Typically, the
each
Examples
-
APPLY(each + 1, 44)returns45 -
The next examples use this lambda:
LAMBDA(foo + bar, foo, bar)-
APPLY(LAMBDA(foo + bar, foo, bar),"Hello, ", "Steve")returnsHello, Steve -
APPLY(LAMBDA(foo + bar, foo, bar),source.first_name, source.last_name)returns the values of thefirst_nameandlast_namefields in source data, with no spaces or any other characters separating the two -
APPLY(LAMBDA(foo + bar, foo, bar),1,2)returns3(i.e. the sum of1and2)
-
Boolean
Description
- Casts the supplied argument(s) to TRUE or FALSE.
Syntax
BOOL(expression, [expression, ...])
Examples
-
BOOL(true)returnstrue -
BOOL(false)returnsfalse -
BOOL(false,true)returns[false,true] -
BOOL(source.id=="abc")returnstrueif the value of theidfield in the source data isabc, otherwise it returnsfalse
Coalesce
Description
- Returns the value of the first non-null expression. The remaining expressions aren't evaluated. An input expression can be any type. There may be multiple input expression types.
Syntax
COALESCE(value, [value,...])
Examples
-
COALESCE(null,1)returns1 -
COALESCE(source.id, source.order_number)returns the value of theidattribute ifidis not null, or theorder_numberifidis null. If both attributes are null,nullis returned.
Filter
Description
- Returns a filtered version of the source range, returning only rows or columns which meet the specified conditions. This function is used in conjunction with a Lambda function.
- Filter is a Lambda Helper function that can be used in conjunction with a Lambda function.
Syntax
FILTER(lambda, list)
-
Alternatively, the Lambda function could be written as an expression with the name
eachas seen below.- This is useful when calling all instances of a repeated attribute in source data. Typically, the
eachwill be referenced in a Lambda Helper Function that supplies more information regarding the variable.
- This is useful when calling all instances of a repeated attribute in source data. Typically, the
each
Examples
-
FILTER(each == 23,[1,2,23])returns[23] -
FILTER(each!="foo",["foo","bar","baz"])returns['bar', 'baz']
Identity
Description
- Returns the value passed into it.
Syntax
IDENTITY(value)
Examples
-
IDENTITY(source.id)returns the value of theidfield in source data -
IDENTITY(true)returnsTRUE -
IDENTITY(1)returns1
If
Description
- Returns one value if a logical expression is
TRUEand another if it isFALSE.
Syntax
IF(test, expression_if_true, expression_if_false)
Examples
-
IF(0<1,"zero is less than one","zero is greater than one")returnszero is less than one -
IF(source.order_no,source.order_no,null)returns theorder_noattribute from the source data if it is not null, otherwise it returnsnull
If Error
Description
- Returns the value passed in, unless it is an error, in which case it returns the alternative value.
Syntax
IFERROR(value, value_if_error)
Examples
-
IFERROR(5+"D","'D' is not a number")returns'D' is not a number -
IFERROR(5+5,"'D' is not a number")returnstbd
Lambda
Description
- Creates and returns a custom function with a set of names and a
formula_expressionthat uses them. To calculate theformula_expression, you can call the returned function with as many values as the name declares. Lambda functions must be paired with a Lambda Helper function. Lambda Helper functions include:- Apply
- Filter
- Flatmap
- List
- Map
- Please note that any function can be used in conjunction with a Lambda function, not just Lambda Helper Functions.
Syntax
There are two options for writing Lambda functions. A standard Lambda function is written as follows:
LAMBDA(variable_name, [variable_name, ...] expression)
Additionally, when a function expects a lambda expression as an argument and that lambda only operates on a single input, you can often use the keyword each as a shorthand. each implicitly represents the single argument that would normally be passed into the lambda. Instead of defining a full lambda function with its argument, you can directly use each within an expression, making the overall expression more concise.
Thus, if a function expects a lambda that adds 1 to a number, you can replace this:
LAMBDA(x,x + 1)
with this:
each + 1
In the second example, each represents the input number.
Examples
To write a simple Lambda consisting of two variables, “foo” and “bar,” that are concatenated together, write the following:
LAMBDA(foo, bar, foo + bar)
This function will not return any data by default, it must be wrapped with a Lambda Helper function. We can use the Apply function to assign values to foo and bar and then execute the Lambda expression:
-
APPLY(LAMBDA(foo + bar, foo, bar),"Hello, ", "Steve"): this expression outputsHello, Steve -
APPLY(LAMBDA(foo + bar, foo, bar),source.first_name, source.last_name): this expression outputs the values of thefirst_nameandlast_namefields in source data, with no spaces or any other characters separating the two -
APPLY(LAMBDA(foo + bar, foo, bar),1,2): this expression outputs the number3(i.e. the sum of1and2) -
For a more real-life example, consider a data source that includes a repeated array of
line_itemobjects structured like this:{... "line_items": [ { "sku":"abc-123-a" "id":"18255552209" "quantity":1 "price":"19.95" "discount":"0.00" }, { "sku":"def-123-b" "id":"18255552209" "quantity":1 "price":"12.50" "discount":"2.00" } ] ...} -
A lambda to return each
line_items.skufrom the data would be paired with a Get function and written like this:each.sku
Not
Description
- Returns the opposite of a logical value.
Syntax
NOT(expression)
Examples
-
NOT(TRUE)returnsFALSE -
NOT(FALSE)returnsTRUE
Or
Description
- Returns true if any of the provided arguments are logically true, and false if all of the provided arguments are logically false. Will apply to all elements of a list in the first position.
ℹ️ This function is often used within IF functions.
Syntax
OR(logical_expression_1, [logical_expression_2, ...])
-
0is logicallyFALSE -
All other numbers (including negative numbers) are logically
TRUE
Examples
-
OR(false,true)returnsTRUE -
OR(false,false)returnsFALSE -
OR(0,1)returnsTRUE
Type
Description
- Returns the Python type of the value within the function, including: str, int, bool, Decimal, dict.
ℹ️ For more info on Python datatypes, go to: Data Types
Syntax
TYPE(value)
Examples
-
TYPE("a")returnsstr -
TYPE(TRUE)returnsbool -
TYPE(12.2)returnsDecimal -
TYPE("2022-12-10")returnsstr -
TYPE(2022-12-10)returnsint(2022-12-10is interpreted as a subtraction, that value resolves to2000, which is an integer) -
TYPE([1,2,3])returns['int', 'int', 'int']
X Or
Description
- Returns
TRUEif an odd number of the provided arguments are logically true, andFALSEotherwise
Syntax
XOR(expression, [expression, ...])
Examples
-
XOR(true,false)returnsTRUE -
XOR(true,false,true)returnsFALSE