© Copyright 2023, Astera Software
Name
If (Int64)
Syntax
If (Boolean condition, Integer thenValue, Integer 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
Int64
Parameters
Condition [System.Boolean] – Condition that is evaluated
thenValue [System.Int64] – This Parameter’s value is returned if the result of ‘condition’ parameter is true.
elseValue [System.Int64] - This Parameter’s value is returned if the result of ‘condition’ parameter is false.
Example
We have a Customers dataset which we will use to evaluate and transform the Items field.
In this example we will use the Expression object to define the condition, and a Variables object to define thenValue and elseValue.
Where,
Condition: Items = “1”
thenValue = 100
elseValue = 200
In the output, you can see that Integer values, 100 and 200, have been returned depending on whether the Items field condition was met.