Logical Functions in Calculated Fields

Logical functions define logical relationships between values.

AND 

Takes a variable number of arguments and returns true if all arguments are truthy.

# Infix operator usage: $a AND $b
# Examples
$roundtrip_ms >= 100 AND $method = "POST"
!IN($method, "GET", "DELETE") AND EXISTS($batch)

# Function usage: AND(arg1, arg2, ...)
# Examples
AND(GTE($roundtrip_ms, 100), EQUALS($method, "POST"))
AND(NOT(IN($method, "GET", "DELETE")), EXISTS($batch))
AND(EQUALS($api_version, "v3"), OR(LT($request_ms, 30), GT($request_ms, 300)))

OR 

Takes a variable number of arguments and returns true if any arguments are truthy.

# Infix operator usage: $a OR $b
# Examples
$company = "acme" OR $priority >= 5
$mysql_latency_ms >= 20 OR ($s3_latency_ms >= 100 AND $method = "GET")

# Function usage: OR(arg1, arg2, ...)
# Examples
OR(EQUALS($company, "acme"), GTE($priority, 5))
OR(GTE($mysql_latency_ms, 20), AND(GTE($s3_latency_ms, 100), EQUALS($method, "GET")))

NOT 

Evaluates the provided argument to a boolean value, and then inverts that value.

# Infix operator usage: !(arg1)
# Examples
!EXISTS($batch)
!IN($build_id, "175", "176")
!IN($company, "acme", "globex", "soylent")

# Usage: NOT(arg1)
# Examples
NOT(EXISTS($batch))
NOT(IN($build_id, "175", "176"))
NOT(IN($company, "acme", "globex", "soylent"))

IN 

Returns true if the first provided argument is equal to any of the subsequent arguments. IN can be thought of as a more compact form of a series of OR equality checks.

# Usage: IN(arg1, compare1, ...)
# Examples
IN($method, "DELETE", "POST", "PUT")
IN($build_id, "9051", "9052")
IN($num_invalid_payloads, 0, 1, -1)

EXISTS 

Returns true when the supplied argument has a defined value. Returns false when the supplied argument does not have a defined value.

# Usage: EXISTS(arg1)
# Examples
EXISTS($batch_size)
EXISTS($team_name)
EXISTS($json_serialization_ms)
On this page: