Hi,
I have a list of sold products and quantities.
In my Json, variable “a1” = Product Name = Category+Size
I want to summarize (sum) the sold quantities by Category.
Is there a module to do this ?
From :
{“productName”:“CategoryA_size1”,“quantity”:“QA1”},
{“productName”:“CategoryA_size2”,“quantity”:“QA2”},
{“productName”:“CategoryA_size3”,“quantity”:“QA3”},
{“productName”:“CategoryB_size1”,“quantity”:“QB1”},
{“productName”:“CategoryB_size4”,“quantity”:“QB4”},
{“productName”:“CategoryB_size6”,“quantity”:“QB6”}
To :
{“CategoryName”:“CategoryA”,“quantity”:“sum(QA)”},
{“CategoryName”:“CategoryB”,“quantity”:“sum(QB)”}
Actually
I have defined this scenario
I’ve managed to extract the categories and quantities to sum.
But I can’t manage to group by category and sum quantities.
Any help would be appreciated.
Thank you
Json example
{
"lineItems": [
{
"a1": "800375_7010_S",
"l1": "Tee-shirt Philibert Charmant écru e",
"q1": "4",
"u1": "pce",
"p1": "19.6",
"m1": "78.4"
},
{
"a1": "800375_7010_L",
"l1": "Tee-shirt Philibert Charmant écru e",
"q1": "4",
"u1": "pce",
"p1": "19.6",
"m1": "78.4"
},
{
"a1": "800375_7010_M",
"l1": "Tee-shirt Philibert Charmant écru e",
"q1": "4",
"u1": "pce",
"p1": "19.6",
"m1": "78.4"
},
{
"a1": "800376_1290_XL",
"l1": "Tee-shirt philibert bleu recyclé es",
"q1": "3",
"u1": "pce",
"p1": "19.6",
"m1": "58.8"
},
{
"a1": "800376_1290_M",
"l1": "Tee-shirt philibert bleu recyclé es",
"q1": "4",
"u1": "pce",
"p1": "19.6",
"m1": "78.4"
},
{
"a1": "800376_1290_S",
"l1": "Tee-shirt philibert bleu recyclé es",
"q1": "4",
"u1": "pce",
"p1": "19.6",
"m1": "78.4"
},
{
"a1": "800376_1290_L",
"l1": "Tee-shirt philibert bleu recyclé es",
"q1": "4",
"u1": "pce",
"p1": "19.6",
"m1": "78.4"
},
{
"a1": "800596_7010_S",
"l1": "Tee-Shirt Baptiste Coq écru en coto",
"q1": "4",
"u1": "pce",
"p1": "19.6",
"m1": "78.4"
},
{
"a1": "800596_7010_M",
"l1": "Tee-Shirt Baptiste Coq écru en coto",
"q1": "4",
"u1": "pce",
"p1": "19.6",
"m1": "78.4"
},
{
"a1": "800596_7010_XL",
"l1": "Tee-Shirt Baptiste Coq écru en coto",
"q1": "3",
"u1": "pce",
"p1": "19.6",
"m1": "58.8"
},
{
"a1": "800596_7010_L",
"l1": "Tee-Shirt Baptiste Coq écru en coto",
"q1": "4",
"u1": "pce",
"p1": "19.6",
"m1": "78.4"
},
{
"a1": "719067_1430_M",
"l1": "Sweat David Gentleman bleu en coton",
"q1": "4",
"u1": "pce",
"p1": "34.8",
"m1": "139.2"
},
{
"a1": "719067_1430_L",
"l1": "Sweat David Gentleman bleu en coton",
"q1": "4",
"u1": "pce",
"p1": "34.8",
"m1": "139.2"
},
{
"a1": "719067_1430_S",
"l1": "Sweat David Gentleman bleu en coton",
"q1": "4",
"u1": "pce",
"p1": "34.8",
"m1": "139.2"
},
{
"a1": "719067_1430_XL",
"l1": "Sweat David Gentleman bleu en coton",
"q1": "3",
"u1": "pce",
"p1": "34.8",
"m1": "104.4"
},
{
"a1": "707876_8041_M",
"l1": "Sweat Basile brodé gris recyclé",
"q1": "4",
"u1": "pce",
"p1": "34.8",
"m1": "139.2"
},
{
"a1": "707876_8041_S",
"l1": "Sweat Basile brodé gris recyclé",
"q1": "4",
"u1": "pce",
"p1": "34.8",
"m1": "139.2"
},
{
"a1": "707876_8041_XL",
"l1": "Sweat Basile brodé gris recyclé",
"q1": "3",
"u1": "pce",
"p1": "34.8",
"m1": "104.4"
},
{
"a1": "707876_8041_L",
"l1": "Sweat Basile brodé gris recyclé",
"q1": "4",
"u1": "pce",
"p1": "34.8",
"m1": "139.2"
},
{
"a1": "713722_1430_S",
"l1": "Tee-shirt Philibert Gentleman bleu ",
"q1": "4",
"u1": "pce",
"p1": "19.6",
"m1": "78.4"
},
{
"a1": "713722_1430_M",
"l1": "Tee-shirt Philibert Gentleman bleu ",
"q1": "4",
"u1": "pce",
"p1": "19.6",
"m1": "78.4"
},
{
"a1": "713722_1430_L",
"l1": "Tee-shirt Philibert Gentleman bleu ",
"q1": "4",
"u1": "pce",
"p1": "19.6",
"m1": "78.4"
},
{
"a1": "713722_1430_XL",
"l1": "Tee-shirt Philibert Gentleman bleu ",
"q1": "3",
"u1": "pce",
"p1": "19.6",
"m1": "58.8"
},
{
"a1": "800607_2550_S",
"l1": "Tee-shirt Barthélémy vélo vert en c",
"q1": "4",
"u1": "pce",
"p1": "19.6",
"m1": "78.4"
},
{
"a1": "800607_2550_M",
"l1": "Tee-shirt Barthélémy vélo vert en c",
"q1": "4",
"u1": "pce",
"p1": "19.6",
"m1": "78.4"
},
{
"a1": "800607_2550_L",
"l1": "Tee-shirt Barthélémy vélo vert en c",
"q1": "4",
"u1": "pce",
"p1": "19.6",
"m1": "78.4"
},
{
"a1": "800607_2550_XL",
"l1": "Tee-shirt Barthélémy vélo vert en c",
"q1": "3",
"u1": "pce",
"p1": "19.6",
"m1": "58.8"
},
{
"a1": "800375_7010_XL",
"l1": "Tee-shirt Philibert Charmant écru e",
"q1": "3",
"u1": "pce",
"p1": "19.6",
"m1": "58.8"
}
],
"echeancier": [
{
"Echeance_dt": "22/08/2023",
"Echeance_mt": "995,54",
"Echeance_no": "1",
"Echeance_status": "A régler"
},
{
"Echeance_dt": "21/09/2023",
"Echeance_mt": "995,54",
"Echeance_no": "2",
"Echeance_status": "A régler"
},
{
"Echeance_dt": "21/10/2023",
"Echeance_mt": "1 025,71",
"Echeance_no": "3",
"Echeance_status": "A régler"
}
]
}