The following examples modify a mapping that calculates sales for the current month. The mapping loads sales for one employee.
This expression flags records for Alex as updates and flags all others for rejection:
IIF( EMPLOYEENAME = 'Alex', DD_UPDATE, DD_REJECT )
This expression uses numeric literals to produce the same result, flagging Alex’s sales for update (1) and flagging all other sales records for rejection (3):
IIF( EMPLOYEENAME = 'Alex', 1, 3 )
The expression using constants is easier to read than the expression using numeric literals.
The following update strategy expression uses SYSDATE to find only those orders that have shipped in the last two days and flag them for insertion. Using DATE_DIFF, the expression subtracts DATE_SHIPPED from the system date, returning the difference between the two dates. Because DATE_DIFF returns a Double value, the expression uses TRUNC to truncate the difference. It then compares the result to the integer literal 2. If the result is greater than 2, the expression flags the records for rejection. If the result is 2 or less, it flags the records for update. Otherwise, it flags them for rejection:
IIF( TRUNC( DATE_DIFF( SYSDATE, ORDERS_DATE_SHIPPED, 'DD' ), 0 ) > 2, DD_REJECT, DD_UPDATE )