IF

IF returns one value if true, and another if false; both are provided by arguments.

Function category: Logical

Syntax

IF(arg1, arg2, arg3)

Arguments

Description

arg1

Condition that returns a value that can be interpreted as true or false.

arg2

Value returned when arg1 evaluates to true.

arg3

Value returned when arg1 evaluates to false.

Example

Let's say we're given a response with the following fleet deployment information.

{
"company_a": {
"deployed": true
}
}

If we want to yield responses dependent on fleet deployment, use the following function.

# Yield a response based on the value of condition
IF(company_a.deployed = TRUE, "Deployed and ready!", "Not deployed, not ready")
# Returns "Deployed and ready!"
# This is because arg1 resolves to TRUE