So i have an array of response from BE with structure like this:
const answer= [
{
"Tanggal": "2023-01-05",
"Plant": "Ranc",
"Gedung / Zona": "Zona 2",
"Sektor": "9",
"Line": "34",
"Shift Running": "3",
"SKU Number": "310902",
"RPH Input": "Planned (H-1)"
},
{
"Tanggal": "2023-01-05",
"Plant": "Ranc",
"Gedung / Zona": "Zona 2",
"Sektor": "9",
"Line": "34",
"Shift Running": "2",
"SKU Number": "310902",
"RPH Input": "Revisi"
},
{
"Tanggal": "2023-01-05",
"Plant": "Ranc",
"Gedung / Zona": "Zona 2",
"Sektor": "9",
"Line": "36",
"Shift Running": "3",
"SKU Number": "300360",
"RPH Input": "Planned (H-1)"
},
{
"Tanggal": "2023-01-05",
"Plant": "Ranc",
"Gedung / Zona": "Zona 2",
"Sektor": "9",
"Line": "36",
"Shift Running": "3",
"SKU Number": "310907",
"RPH Input": "Planned (H-1)"
},
{
"Tanggal": "2023-01-05",
"Plant": "Ranc",
"Gedung / Zona": "Zona 2",
"Sektor": "9",
"Line": "37",
"Shift Running": "3",
"SKU Number": "310908",
"RPH Input": "Planned (H-1)"
},
{
"Tanggal": "2023-01-05",
"Plant": "Ranc",
"Gedung / Zona": "Zona 2",
"Sektor": "11",
"Line": "43",
"Shift Running": "1",
"SKU Number": "310101",
"RPH Input": "Planned (H-1)"
},
{
"Tanggal": "2023-01-06",
"Plant": "Ranc",
"Gedung / Zona": "Zona 2",
"Sektor": "11",
"Line": "43",
"Shift Running": "2",
"SKU Number": "321294",
"RPH Input": "Planned (H-1)"
},
{
"Tanggal": "2023-01-06",
"Plant": "Ranc",
"Gedung / Zona": "Zona 2",
"Sektor": "11",
"Line": "44",
"Shift Running": "3",
"SKU Number": "300079",
"RPH Input": "Planned (H-1)"
}
]
i try to grouped it into date with condition if the “Tanggal”,”Plant”,”Gedung/Zona”,”sektor”,Line,Shift Running, and SKU number is the same but the RPH input has value “Revisi”, it will only group the value from RPH input that has value revisi instead of the Planned (H-1), with expected array to be like this, the value of the date is the accumulated value from Shift Running:
const tranfrdata=[{ "2023-01-05": 12,
"2023-01-06": 5 }]
it possible for me to just group it based on date, but for the logic i mention above, is that possible to do that? or any help on this?