AnsweredAssumed Answered

How to aggregate the values on multiple records into one?

Question asked by deepa.govind@integration.works on Dec 13, 2017
Latest reply on Dec 13, 2017 by deepa.govind@integration.works

I have this requirement where a flatfile input is converted to a JSON

 

Then it is split based on "Year|Make|Model" into an array of objects 

 

ex. 2010|Toyota|Corolla 

      2010|Toyota|Camry and so on.

 

My requirement is to get the floor(avgretail) and ceil(goodretail) from the below array and combine them into a single JSON object.


An example input like below: 
[
{
"make" : "Toyota",
"model " : "Corolla",
"year" : "2010",
"avgretail" : "12500",
"goodretail" : "20500"
},
{
"make" : "Toyota",
"model " : "Corolla",
"year" : "2010",
"avgretail" : "13500",
"goodretail" : "22500"
},
{
"make" : "Toyota",
"model " : "Corolla",
"year" : "2010",
"avgretail" : "12750",
"goodretail" : "21400"
}
]

Output should look like:

{
"make" : "Toyota",
"model " : "Corolla",
"year" : "2010",
"avgretail" : "12000",
"goodretail" : "23000"
}

 

Appreciate if anyone could give me an insight on this please?

 

Cheers
Deepa

Outcomes