Conditional functions

  • Latest Dynatrace
  • Reference

Functions that return a conditional result.

coalesce

Returns the first non-null argument, if any, otherwise null.

Syntax

coalesce(expression, …)

Parameters

Returns

Returns the first non-null argument, if any, otherwise null.

Examples

Example 1
data record(a = "a", b = "b", c = "c"),
record(b = "b", c = "c"),
record(c = "c"),
record()
| fieldsAdd coalesce(a, b, c)

Query result:

if

Evaluates the condition, and returns the value of either the then or else parameter.

Syntax

if(condition, then [, else])

Parameters

Returns

Returns the value of the then parameter if the condition evaluated to true. Returns the value of the else parameter if the condition evaluated to false or null. Returns null if the condition evaluated to false or null and the else parameter is missing.

Examples

Example 1
data record(a = 10),
record(a = 20)
| fieldsAdd if(a < 15, "a is smaller than 15"),
if(a < 15, "a is smaller than 15", else: "a is not smaller than 15")

Query result:

Related tags
Dynatrace Platform