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¶
ontrue
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 | storable | no | no | none | 
| onfalse | ontrue | 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