06-28-2021 06:04 AM
hi there, I have data coming in these structures
source1 -
{
"@type": "array",
"order-line": [
{
"line-num": "00010",
"attachments": {
"@type": "array",
"attachment": {
"type": "AttachmentText",
"text": "Testing the Long Text Documents"
}
}
},
{
"line-num": "00020",
"attachments": {
"@type": "array",
"attachment": [
{
"type": "AttachmentText",
"text": "This is the Third time being sent.\n\nIn our continuing efforts to reduce transportation costs and increaseefficiency Clearway Energy Inc. has contracted Malark Logistics andjointly developed the following routing instructions. Please complywith the following instructions. Failure to comply will result inescalating non-compliance fees beginning at $50.00 per shipment andreaching $250 plus freight costs for subsequent violations.\n"
},
{
"type": "AttachmentText",
"text": "This is the second time being sent.\n\nIn our continuing efforts to reduce transportation costs and increaseefficiency Clearway Energy Inc. has contracted Malark Logistics andjointly developed the following routing instructions. Please complywith the following instructions. Failure to comply will result inescalating non-compliance fees beginning at $50.00 per shipment andreaching $250 plus freight costs for subsequent violations.\n"
}
]
}
}
]
}
and source2 -
{
"line-num": "00020",
"attachments": [
{
"type": "AttachmentText",
"text": "This is the second time being sent.\n\nIn our continuing efforts to reduce transportation costs and increaseefficiency Clearway Energy Inc. has contracted Malark Logistics andjointly developed the following routing instructions. Please complywith the following instructions. Failure to comply will result inescalating non-compliance fees beginning at $50.00 per shipment andreaching $250 plus freight costs for subsequent violations.\n",
"Id": null
}
]
}
how can I compare to see Source2 Atttachment.Text exists in Attachment.Text of Source1’s , where line-num is same?
Any help is greatly appreciated.
Thanks
Manohar
Solved! Go to Solution.
06-29-2021 12:39 AM
Hello @manohar,
You can also try this pipeline. As a result you’ll get the original payloads, and an extra boolean field for the condition stated above.
Array Comparison_2021_06_29.slp (8.7 KB)
Regards,
Bojan
06-29-2021 12:26 AM
@manohar Can try attach pipeline .
compare_coummunty_2021_06_29.slp (10.0 KB)
07-05-2021 08:05 AM
Hi Bojan,
Very nice…
there’s a small change in the requirement. Need to consider Date Time as well when comparing. if the Text matched is in the past then latest, then need to be added to the Line Num. If the Text matched is the latest, then need to ignore.
Wondering how to get the latest of the 2 in this case, any pointers?
Any help is greatly appreciated.
Thanks
Manohar
{
"@type": "array",
"order-line": [
{
"line-num": "00010",
"attachments": {
"@type": "array",
"attachment": {
"type": "AttachmentText",
"datetime": "2021-07-04 18:20:10",
"text": "Testing the Long Text Documents"
}
}
},
{
"line-num": "00020",
"attachments": {
"@type": "array",
"attachment": [
{
"type": "AttachmentText",
"datetime": "2021-07-04 18:20:20",
"text": "This is the Third time being sent.\n\nIn our continuing efforts to reduce transportation costs and increaseefficiency Clearway Energy Inc. has contracted Malark Logistics andjointly developed the following routing instructions. Please complywith the following instructions. Failure to comply will result inescalating non-compliance fees beginning at $50.00 per shipment andreaching $250 plus freight costs for subsequent violations.\n"
},
{
"type": "AttachmentText",
"datetime": "2021-07-04 19:40:21",
"text": "This is the second time being sent.\n\nIn our continuing efforts to reduce transportation costs and increaseefficiency Clearway Energy Inc. has contracted Malark Logistics andjointly developed the following routing instructions. Please complywith the following instructions. Failure to comply will result inescalating non-compliance fees beginning at $50.00 per shipment andreaching $250 plus freight costs for subsequent violations.\n"
}
]
}
}
]
}
06-29-2021 12:39 AM
Hello @manohar,
You can also try this pipeline. As a result you’ll get the original payloads, and an extra boolean field for the condition stated above.
Array Comparison_2021_06_29.slp (8.7 KB)
Regards,
Bojan
07-05-2021 12:21 PM
Hey Manohar,
This is a quite intriguing task. Check my updated version, the boolean field will still be true if the text is present in the attachments in source 2, but the datetime field will only be added if it’s the latest between dates.
Array Comparison V1.1_2021_07_05.slp (9.6 KB)