08-13-2024 01:59 PM - edited 08-16-2024 08:58 AM
Hi team,
I would like to iterate thru an array of objects and verify if the objects has same num, code and date with different boxNumbers, then I should add the boxNumbers together and make that as a single object. If those three didn't match I should leave the object as is. Could you please help me on this?
Sample Input data:
[
{
"product": [
{
"num": "69315013901",
"code": "C06024",
"date": "2026-03-31",
"boxNumber": [
"453215578875",
"964070610419"
]
},
{
"num": "69315013901",
"code": "C06024",
"date": "2026-03-31",
"boxNumber": [
"153720699865",
"547398527901",
"994797055803"
]
},
{
"num": "69315030805",
"code": "083L022",
"date": "2025-11-30",
"boxNumber": [
"VUANJ6KYSNB",
"DPPG4NWK695"
]
}
]
}
]
Expected Output:
[
{
"product": [
{
"num": "69315013901",
"code": "C06024",
"date": "2026-03-31",
"boxNumber": [
"453215578875",
"964070610419",
"153720699865",
"547398527901",
"994797055803"
]
},
{
"num": "69315030805",
"code": "083L022",
"date": "2025-11-30",
"boxNumber": [
"VUANJ6KYSNB",
"DPPG4NWK695"
]
}
]
}
]
Solved! Go to Solution.
08-14-2024 12:40 AM
Hello @lake,
Attached is the sample pipeline for structuring the data as needed:
Let me know if you have any questions.
Best regards,
Aleksandar.
08-14-2024 12:40 AM
Hello @lake,
Attached is the sample pipeline for structuring the data as needed:
Let me know if you have any questions.
Best regards,
Aleksandar.
08-14-2024 11:18 AM
Hi Aleksandar,
Thank you so much. I would like to know where are you checking the equivalence of num, lotNumber and expDate of first ndc object with the next ndc object?
08-15-2024 01:12 AM
Hello,
The functionality of the Group By Fields Snap does that. It groups the documents by the value of fields.
Regards,
Aleksandar.