The following examples modify a mapping that calculates monthly sales by salesperson, so you can examine the sales of just one salesperson.
The following update strategy expression flags an employee’s sales for insertion, and rejects everything else:
IIF( EMPLOYEENAME = 'Alex', DD_INSERT, DD_REJECT )
This update strategy expression uses numeric literals to produce the same result:
IIF( EMPLOYEENAME = 'Alex', 0, 3 )
The expression using constants is easier to read than the expression using numeric literals.
The following update strategy expression uses SESSSTARTTIME to find only those orders that 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 them for insertion:
IIF( TRUNC( DATE_DIFF( SESSSTARTTIME, ORDERS_DATE_SHIPPED, 'DD' ), 0 ) > 2,DD_REJECT, DD_INSERT )