A newer version of this documentation is available.

View Latest

Conditional Functions for Numbers

  • reference
    +

    Conditional functions evaluate expressions to determine if the values and formulas meet the specified condition.

    IFINF(expression1, expression2, ...)

    Description

    Returns first non-MISSING, non-Inf number. Returns MISSING or NULL if a non-number input is encountered first.

    IFNAN(expression1, expression2, ...)

    Description

    Returns first non-MISSING, non-NaN number. Returns MISSING or NULL if a non-number input is encountered first.

    IFNANORINF(expression1, expression2, ...)

    Description

    Returns first non-MISSING, non-Inf, or non-NaN number. Returns MISSING or NULL if a non-number input is encountered first.

    NANIF(expression1, expression2)

    Description

    Returns NaN if expression1 = expression2, otherwise returns expression1. Returns MISSING or NULL if either input is MISSING or NULL.

    NEGINFIF(expression1, expression2)

    Description

    Returns NegInf if expression1 = expression2, otherwise returns expression1. Returns MISSING or NULL if either input is MISSING or NULL.

    POSINFIF(expression1, expression2)

    Description

    Returns PosInf if expression1 = expression2, otherwise returns expression1. Returns MISSING or NULL if either input is MISSING or NULL.

    Examples

    Example 1. Return null if infinite value is encountered.
    Query
    select IFINF(0 / 0, 25, 23) as INF
    Result
    [
      {
        "INF": null
      }
    ]
    Example 2. Return first non-infinite value encountered.
    Query
    select IFINF(35, 0 / 0, 25, 23) as NONINF
    Result
    [
      {
        "NONINF": 35
      }
    ]