Greetings,
I have an array of products like below where the same item may appear more than once with a different qty:
{
"items" : [
{
"sku": "123",
"qty": 10
},
{
"sku": "123",
"qty": 5
},
{
"sku": "XYZ",
"qty": 3
}
]
}
I need to calculate the total qty of each sku.
An example of what I’m trying to get to would be:
{
"items" : [
{
"sku": "123",
"qty": 15
},
{
"sku": "XYZ",
"qty": 3
}
]
}
I think I need to use something with Group records, but I’m not sure how to calculate the total after that.
Suggestions?
Thanks!