AND

AND returns true if the provided arguments all return logical true, otherwise it returns false. Everything except false is treated as true.

Function category: Logical

Syntax

AND(arg1, [arg2...])

Parameters

AND can take an arbitrary number of additional arguments.

Arguments

Description

arg1

Expression that can be interpreted as true or false (including numbers, strings, and arrays etc.).

arg2

Optional. Same restrictions as arg1.

Examples

Let's say we're given two responses with the following fleet deployment information.

The first response has values given for three fleets.

{
"company_a": {
"deployments": {
"fleet_1": true,
"fleet_2": true,
"fleet_3": true
}
}
}

The second response has values for only one fleet while fleet_2 has a null value.

{
"company_b": {
"deployments": {
"fleet_1": 1,
"fleet_2": null
}
}
}

Example 1: Completed deployment

If we want to determine if deployments are completed, use the following function.

# If deployments are completed, return true
AND(company_a.deployments.fleet_1,
company_a.deployments.fleet_2,
company_a.deployments.fleet_3)
# Returns true

Example 2: "Truthy" results

We can also interpolate different kinds of "truthy" results.

# If deployments are completed, return true
AND(company_a.deployments.fleet_1,
company_b.deployments.fleet_1)
# Returns true
# If deployments are compleed, return true
AND(company_a.deployments.fleet_1,
company_b.deployments.fleet_2)
# Returns false