queries:functions:if

if

The if function is used to apply a condition on a column. The first parameter is a condition, the second parameter is returned if the condition returns true and the third parameter is returned if the condition is false.

Return Type Dynamic
Aggregates No
Flags None

Parameters

Parameters: if(condition, true_result, false_result)

Name Type Description
condition boolean The condition which will decide whether true_result or false_result will be returned.
true_result dynamic The value which will be returned if the condition evaluates to true.
false_result dynamic The value which will be returned if the condition evaluates to false.

Example Queries

The following query shows the status of all experiments

draw table 
using name, if(running, 'Running', if(preview, 'Preview', 'Stopped')) as Status from @experiments

IN THIS ARTICLE