We have a Customers dataset which we will use to evaluate and transform the ShipDate 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: ShipDate = “1”
thenValue = 1/2/2022
elseValue = 5/7/2023
In the output, you can see that DateTime values, 1/2/2022 and 5/7/2023, have been returned depending on whether the ShipDate field condition was met.
Name
If (DateTime)
Syntax
If (Boolean condition, DateTime thenValue, DateTime 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
DateTime
Parameters
Condition [System.Boolean]
thenValue [System.DateTime] – This Parameter’s value is returned if the result of ‘condition’ parameter is true.
elseValue [System.DateTime] - This Parameter’s value is returned if the result of ‘condition’ parameter is false.