Forum Discussion
bojanvelevski
3 years agoValued Contributor
Hi @nirupama , welcome!
I believe the following expression in a mapper will do the job:
$group.find(x=>x.STATUS == 'ACCEPTED') != null ? $group.find(x=>x.STATUS == 'ACCEPTED') : $group.sort((a,b)=> a.ESTVERSION - b.ESTVERSION).pop()
Translated version would be:
“If one object in the group has a “STATUS” field with “ACCEPTED” as value, than take that object. If not, than order the group on the “ESTVERSION” field, and take the last one, which means the max ESTVERSION.”
Thank you @bojanvelevski. It is working as expected. I tried with mapping expression you mentioned above by making few more changes in the input data and i’m able to fetch proper estversion.
Thank you!!
Related Content
- 5 years ago
- 8 years ago
- 7 months ago