© Copyright 2023, Astera Software
Name
If (Boolean)
Syntax
If (Boolean condition, Boolean thenValue, Boolean elseValue)
Purpose
To evaluate a given condition and if true, return result of thenValue. Otherwise, to return the result of elseValue.
Description
Returns the value of ‘Then’ expression or ‘Else’ expression depending on the value of condition.
Return Type
Boolean
Parameters
Condition [System.Boolean]
thenValue [System.Boolean] – This Parameter’s value is returned if the result of ‘condition’ parameter is true.
elseValue [System.Boolean] - This Parameter’s value is returned if the result of ‘condition’ parameter is false.
We have a Customers dataset which we will use to evaluate whether the Country field consists of the value “Germany”.
We will use the Expression object to give this condition, and a Variables object to define thenValue and elseValue.
Where,
Condition: Country = “Germany”
thenValue = True
elseValue = False
In the output, you can see that Boolean values, True and false, have been returned depending on whether the Country field condition was met.