Example 2
The SC_ITEM table contains standard cost data in the std_cost column, which is imported from ERP. You can also override the imported value with the xs_std_cost override value. The override value can be manually specified through SCV Datasheets or updated for all records using Data Enhancement Rules.
In this example, the rule verifies the imported value. If the value is not specified or 0, the override value is set to the sum of the imported value and the override value. Else, the imported value is considered.
Default Rule for (A) - Use the sum of std_cost and xs_std_cost where SC_ITEM.std_cost IS NULL OR SC_ITEM.std_cost = 0
- Target Table: SC_ITEM
- Include extension columns: On
- Target Column = xs_std_cost
- Rule Type: Expression
- Expression: SC_ITEM.std_cost + SC_V_EXT_ITEM.xs_std_cost
- Filter:
Add OR Condition SC_ITEM std_cost Is Not Null OR SC_ITEM std_cost Does not Equal 0 Preview SC_ITEM.std_cost Is Not Null OR SC_ITEM.std_cost<>0
- Final expression:
UPDATE SC_V_EXT_ITEM SET SC_V_EXT_ITEM.xs_std_cost = SC_ITEM.std_cost + SC_V_EXT_ITEM.xs_std_cost FROM SC_V_EXT_ITEM JOIN SC_ITEM ON SC_ITEM.item_id = SC_V_EXT_ITEM.item_id -- Uses the PK definition to join WHERE SC_ITEM.std_cost Is Not Null OR SC_ITEM.std_cost<>0