Skip to content
HPCCSystems Solutions Lab
HPCCSystems Solutions Lab

IF Statement

The IF function allows you to make a logical comparison between value(s) and what returning a result if that condition is True or False.


attr_name := IF(expression, true_result [, false_result])
attribNameThe name by which the variable will be invoked.
expressionBoolean expression to be check for True or False
true_resultResult value or action if expression is True
false_resultMay be omitted only if true_result is an action

#### Example
IF Example:
Example includes nested IF*/

Permission := 23;
Age        := 12;

Res1 := IF(Permission >= Age, 'Application Accepted', 'Application Rejected');

Flag := FALSE;
Res2 := IF(Flag, ', Try Again', ', Move on');

Final := IF(Res1 = 'Application Accepted' AND Res2 = ', Move on',
              OUTPUT(Res1 + Res2, NAMED('Passed')),
              OUTPUT(Res1 + Res2, NAMED('Failed'))

Try Me

Logical Operators

Logical values that can be used for comparison of two values.

>Greater than
<Less than
>=Greater than or equal
<=Less than or equal
<>Not equal
!=Not equal
ANDLogical AND
ORLogical OR
INTo specify multiple possible values for a field/column
NOT INTo specify multiple possible values that are not in a field/column
BETWEENBetween a certain range