if¶
Description¶
Test if a condition is true or false.
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 |
Optional |
Repeatable |
Restrictions |
---|---|---|---|---|
condition |
bool |
no |
no |
none |
ontrue |
comparable |
no |
no |
none |
onfalse |
comparable |
no |
no |
none |
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