This article describes the Nested IF-THEN-ELSE transformation rule and how to use it to perform action when doing a transformation override on a moov configuration.
When applying a transformation override to a field, you can apply the Nested IF-THEN-ELSE rule based on conditional logic. If a value meets the specified condition, return value x, if the condition is not met, return value y (or nest another IF-THEN-ELSE statement).
Example:
Let's say we need to remove the Termination Date of an employee if the employee's Rehire Date is greater than the Termination Date (the employee was hired, terminated and then rehired). To accomplish this, we would edit the moov configuration and expand the Transformation Overrides section of the Action - Transform Step:
Then click the ADD button and select the field we want to perform the Nested IF-THEN-ELSE on:
NOTE: remove any existing transformation rules on the field before continuing to the next step.
In the Input Field dropdown, select the Rehire Date and leave the Termination Date checked.
Then click the ADD RULE button and select the 'Nested IF-THEN-ELSE' rule.
The Statement field is where you will enter the IF-THEN-ELSE statement specific to your needs.
Each Input Field selected is assigned a numeric value that will be used in the IF-THEN-ELSE statement.
Using the syntax mentioned previously, we would create our statement using the Input Field numeric values:
IF([1]>[2],"",[2])
Our statement reads: If the Rehire Date is greater than the Termination Date, return an empty string, else return the Termination Date.
Our completed transformation rule would look like this:
Listed below are the valid operators that can be used in a Nested IF-THEN-ELSE statement:
Operator | Definition | Example |
---|---|---|
= | Equal to | IF([1]=[2],"equal","not equal") |
< | Less than | IF([1]<[2],"less than","greater than") |
> | Greater than | IF([1]>[2],"greater than","less than") |
<> | Not Equal to | IF([1]<>[2],"not equal","equal") |
=% | Starts with | IF([1]=%"A","starts with A","doesn't start with A") |
%= | Ends with | IF([1]%="Z","ends with Z","doesn't end with Z") |
%% | Contains | IF([1]%%"ABC","contains ABC","doesn't contain ABC") |