Get the id corresponding to the field with the highest value

Hello everyone,

I need your help again…

In my scenario, I have the “Numeric Agregator” module to search for the highest value of a field coming from a text parser.

It correctly returns the highest value to me, but I want it to return other information corresponding to the collection find (id for example).

Do you know how we can get the id corresponding to the field with the highest value?

Thank you in advance !

Hello!

I have an ugly solution for you :joy:

So the first step would be that you aggregate the data using an Array Aggregator, in order to have an Array with the value and the id (or any other field you need).

Then, you use the map function to extract only the value field => you get an array of values
Then you use the max function to extract the biggest value from this array
Then you use again the map function, on the initial array, to pick the id, where value=max
Then you take the first element (since map generates an array).

If you group these functions, you can make it much shorter (one operation after the Array Aggregator)

I did a little scenario to show you. The first 2 steps are to simulate the output of your Text Parser. The top route shows each parts, the bottom route aggregates all functions in one.

Demo extract ID where Max Value.json (14.8 KB)

Benjamin

3 Likes