Question
I would like to output a CSV of the difference between two CSV files (which are the columns do not match) as shown below.
Is there any good way to achieve this?
File A
A internal ID,A external ID
100,500
101,600
102,700
103,900
File B
B internal ID,B external ID
100,500
101,550
102,700
104,800
Desired results (CSV of symmetric difference set)
A internal ID, A external ID, B internal ID, B external ID
101,600,101,550
103,900,null,null
null,null,104,800
Answer
The process of extracting the difference between two CSV data can be achieved by using Merge logic.
Please refer to the following example of an implementation procedure.
-
Combine the data A and B into one data using Or-Integrate Merge logic
As the specification of the Or-Integrate Merge logic, it merges multiple input source data and output the result that matches the conditions as one output data.The data of file A and B are merged and combined into a single data output by specifying "A internal ID" and "B internal ID" as key values and specifying "A internal ID", "A external ID", "B internal ID", and "B external ID" as output destination columns.
-
Export merged data once to a CSV file
Output the output data merged above as a CSV file by the Write CSV File component. -
Re-read the output CSV file and extract the data in the mapping based on conditions with different external IDs
Read the CSV file output above by the Read CSV component and extract data with the following conditions by mapping.- Compare if there is any mismatch between "A external ID" and "B external ID" by the Different logic in [Condition]-[String].
- Specify the comparison result of the Different logic as a repeat condition In the If Loop logic in [Repeat]-[Specify condition]. -
Output the extracted data to a CSV file.
Output the extracted data in the former step to a CSV file as it is the symmetric difference set data of A and B.
For details on the merge logic, please also refer to the following document pages.
Logic specification (Merge Mapper)
https://www.hulft.com/help/en-us/HULFTSquare/Content/Designer/Mapper/mpp_logic_spec.htm
Or-Integrate Merge
https://www.hulft.com/help/en-us/HULFTSquare/Content/Designer/Mapper/OrIntegrate.htm
Comments
0 comments
Article is closed for comments.