if¶
Description¶
Return the second argument if condition# is true, otherwise return third argument. Arguments must have the same general type.
Return type¶
least common generalization skipping variants
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 |
Constant |
---|---|---|---|---|
condition |
bool |
Required |
Only one |
Variable |
ontrue |
variant |
Required |
Only one |
Variable |
onfalse |
variant |
Required |
Only one |
Variable |
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