โ04-17-2020 05:03 AM
I am trying to group and sum an amount by two properties with the expression language with no luck. I tried using the reduce function, but itโs not working like it does in traditional javascript. Is there any way to get this to work? Here is my input document:
[
{
โroโ: [
{
โprodโ: โproduct1โ,
โdivโ: โdivision1โ,
โamountโ: 178.25
},
{
โprodโ: โproduct1โ,
โdivโ: โdivision2โ,
โamountโ: 758.65
},
{
โprodโ: โproduct1โ,
โdivโ: โdivision2โ,
โamountโ: 10000.79
},
{
โprodโ: โproduct2โ,
โdivโ: โdivision2โ,
โamountโ: 5678.10
}
]
}
]
Here is my expected output:
[
{
โroโ: [
{
โprodโ: โproduct1โ,
โdivโ: โdivision1โ,
โamountโ: 178.25
},
{
โprodโ: โproduct1โ,
โdivโ: โdivision2โ,
โamountโ: 10759.44
},
{
โprodโ: โproduct2โ,
โdivโ: โdivision2โ,
โamountโ: 5678.10
}
]
}
]
โ04-17-2020 05:56 AM
What was the expression you tried that didnโt work?
โ04-22-2020 04:29 AM
I was able to use the reduce function to handle this. I made a simple mistake in one of my attempts and abandoned it too quickly.
โ04-26-2020 07:32 AM
Hi @wcl3y2
i tried to implement using aggregate snap.
testW3C_2020_04_26 (1).slp (6.0 KB)