Conditional Operators
AMPS contains support for a ternary conditional IF
operator which allows for a Boolean condition to be evaluated to true
or false
, and will return one of the two parameters. The general format of the IF
statement is:
In this example, the BOOLEAN_CONDITIONAL
will be evaluated, and if the result is true, the VALUE_TRUE
value will be returned otherwise the VALUE_FALSE
will be returned.
For example:
The above example returns a count of the total number of orders that have been placed where the symbol is MSFT and the order contains a quantity more than 500.
The IF
operator can also be used to evaluate results to determine if results are NULL
or NaN
. This is useful for calculating aggregates where some values may be NULL
or NaN
. The NULL
and NaN
values are discussed in more detail in the AMPS Data Types section.
For example:
Last updated