Hi Community
I need help to create an array with data from other arrays. The unique key will be Code rest all may have different values. The Quantity parameter needs to be combined in each row. the Source Data is expected to be Array of 10000 "Array" and each "Array" can have about 100 to 200 objects. The Desired array is supposed to match the object on the basis of "Code" and add "Quantity" property from source array to Desired Output array as Q1, Q2, Q3, Q4, Q5, etc.
Source Data Array:
-------------------------
[
{
"Array": [
{
"Type": " ",
"Code": "",
"Item": "H",
"Quantity": "1"
},
{
"Type": "",
"Code": "",
"Item": "B",
"Quantity": "2"
},
{
"Type": "HW",
"Code": "123456",
"Item": "Test Item1",
"Quantity": "3"
},
{
"Type": "HW",
"Code": "789123",
"Item": "Test Item3",
"Quantity": "9"
}
]
},
{
"Array": [
{
"Type": " ",
"Code": "",
"Item": "H",
"Quantity": "4"
},
{
"Type": "",
"Code": "",
"Item": "B",
"Quantity": "5"
},
{
"Type": "HW",
"Code": "123456",
"Item": "Test Item1",
"Quantity": "3"
},
{
"Type": "HW",
"Code": "456789",
"Item": "Test Item2",
"Quantity": "6"
},
{
"Type": "HW",
"Code": "789123",
"Item": "Test Item3",
"Quantity": "9"
}
]
},
{
"Array": [
{
"Type": " ",
"Code": "",
"Item": "H",
"Quantity": "7"
},
{
"Type": "",
"Code": "",
"Item": "B",
"Quantity": "8"
},
{
"Type": "HW",
"Code": "456789",
"Item": "Test Item2",
"Quantity": "6"
},
{
"Type": "HW",
"Code": "789123",
"Item": "Test Item3",
"Quantity": "9"
}
]
}
]
-------------------------
Desired Output:
-------------------------
[
{
"Type": " ",
"Code": "",
"Item": "H",
"Q1": "1",
"Q2": "4",
"Q3": "7"
},
{
"Type": "",
"Code": "",
"Item": "B",
"Q1": "2",
"Q2": "5",
"Q3": "8"
},
{
"Type": "HW",
"Code": "123456",
"Item": "Test Item1",
"Q1": "3",
"Q2": "3",
"Q3": ""
},
{
"Type": "HW",
"Code": "456789",
"Item": "Test Item2",
"Q1": "",
"Q2": "6",
"Q3": "6"
},
{
"Type": "HW",
"Code": "789123",
"Item": "Test Item3",
"Q1": "9",
"Q2": "9",
"Q3": "9"
}
]
-------------------------