if

Description

Return the second argument if condition# is true, otherwise return third argument. Arguments must have the same general type.

Return type

any

Domain

This is a scalar function (calculates a single output value for a single input row.)

Categories

Usage

if( condition, ontrue, onfalse )

Argument

Type

Required

Multiple

condition

bool

Required

Only one

ontrue

any

Required

Only one

onfalse

any

Required

Only one

Examples

filter b=if(a=true, 'foo', 'bar')

Filter input to rows where b is equal to ‘foo’ if ‘a’ is true and ‘bar’ otherwise