Conditional Data Mapping to Target Schema
I have a sample invoice source file that contains 2 records with 7 columns. The Column names are below.
INVOICE_NUM
INVOICE_AMOUNT
VENDOR
COSTCENTER1
COSTCENTER1_AMT
COSTCENTER2
COSTCENTER2_AMT
The output I need to create is a new line for each cost center if it’s defined, so if there is a value for Cost Center 2 then the target file would have two entries for correlating invoice number.
-
Below are the high level steps that can be followed for fulfilling this requirement:
-
In Data Mapper create a Clone node by right clicking on the Record Node of target Schema.
-
Apply For Each on root of Target with Record of Source Schema.
-
Use flag variable in context and set it's value as True if the value of COSTCENTRE2 is not null else it will be set as false.
-
Apply one to one mapping on all the fields of main node at Target side.
-
On Record Level of Clone node, set back the value of flag as false.
-
Using IFF condition decide the value of Clone node if flag is true then it's value is passed else not.
-
Map all the required fields for clone node and map the COSTCENTRE2 and COSTCENTRE12_AMT with GENERAL_LEDGER and AMOUNT respectively.
0 -
Post is closed for comments.
Comments
1 comment