How select the cheapest price object in a table of array

Hi,

I am trying to generate shipping label with easypost but I am stuck at the price selection.
Unfortuanly, eaypost create rate object with different order in the Rates table price every time.

For example I can select the object ] 2 [ but the price of this rate object can change.

I am trying to use a function like sort() to re arrange the rates table by the lowest price and select the first object.

I am unsure how to use a function like sort() or find() with an array.

I have found the map function, but I can t use the result to find the lowest rate id…

Hi @Will2 nice to meet you.

Have you tried to use min function? For this function, you have to be sure that the out coming data is a number and if not you can use function parseNumber.
image

Don’t hesitate to contact us if you require further assistance.

//VLAD

1 Like

Got it!
I was able to get the cheapest rate with the first and map functions

{{first(map(5.rates; "id"; "service"; "First"))}}```

Hope that will help people who are stuck with the easypost rate management.

Heya @Will2 welcome to the community and great work figuring out how to make this work :clap:

Also, thanks a lot for sharing your solution with the community. I’m sure this is gonna be super helpful for someone in the future :pray: