Forum Discussion
Not sure I understand your requirements here, are the differences already being spotter, and you only need to construct the data? If yes, check the pipeline below:
If this is not what you need, please share some more details.
Regards,
Bojan
- Imran2 years agoNew Contributor
@bojanvelevski - The SRC and TGT columns will be dynamic, the above given is just an example. As you said, I am able to spot the difference. But I need to dynamically iterate over json and find the difference between same column present in source and target. (There might be chance that there might be difference in other columns as well), any help is appreciated.
Adding more info -If the Input is
[
{
"SRC_DATE": "2023-11-20 09:24:29.231",
"SRC_NAME": "AGENT",
"SRC_OWNER": "JHON",
"TGT_DATE": "2023-11-20 09:24:29.231",
"TGT_NAME": "AGENT_TEST",
"TGT_OWNER": "CHRIS",
"reason": "Source & Target Records Different",
"srcTable": "CLASS",
"primaryColumns": "DATE,NAME",
"nonPrimaryColumns": "OWNER",
"srcSchool": "TEST"
}
]
The output I am looking for is -[
{
"COLUMN_NAME" : "SRC_OWNER",
"COLUMN_VALUE_SRC": "JHON",
"COLUMN_VALUE_TGT": "CHRIS",
"reason": "Source & Target Records Different",
"srcTable": "CLASS",
"primaryColumns": "DATE,NAME",
"nonPrimaryColumns": "OWNER",
"srcSchool": "TEST"
},
{
"COLUMN_NAME" : "SRC_NAME",
"COLUMN_VALUE_SRC": "AGENT",
"COLUMN_VALUE_TGT": "AGENT_TEST",
"reason": "Source & Target Records Different",
"srcTable": "CLASS",
"primaryColumns": "DATE,NAME",
"nonPrimaryColumns": "OWNER",
"srcSchool": "TEST"
}
]