I have this formula where I get data from an API. I want to sort the data by total_races, but for tiebreakers it should be determined by races wins, podiums and least DNFs. How should I edit my formula to obtain this?
✅1
Andreas Møller
1 year ago
If you give the sort formula an array as second input it will sort based on priority
Lukas Mohr
1 year ago
Inbetween the API and the Sort by?
Andreas Møller
1 year ago
No instead of Item/total_races you give it an array where Item/total races is the first item.
Then what ever you want to sort by after that as item 2
Andreas Møller
1 year ago
Does that make sense?
Lukas Mohr
1 year ago
{{ total_races, races_won, top_three_finishes }} like this?
Lukas Mohr
1 year ago
Maybe I got it
Lukas Mohr
1 year ago
But not working as inteded.
Andreas Møller
1 year ago
Almost, pick total races on the bottom left node
Then that will be the primary sort criterion
If you add more items to the array it will sort by them in case of a tie
✅1
Lukas Mohr
1 year ago
Very easy then! Many thanks 😄
noCode.Lad
1 year ago
I learnt something here today. Many thanks
Xioteer
1 year ago
Let me revive this one. The above is clear. How can I reverse the sorting of the second one? I have first criteria "dates", ascending The second one is something else, sorting works, but I would like to have that descending. Is that possible?
Xioteer
1 year ago
Got a second thing here With the standard sorting positive and negative numbers are handled separately. It's sorted by P/L on the right. There you can see what is happening. It's restarting with the highest negative number instead of decreasing from 0.00
every api is different. I obviously declare my Xano ones as numbers if I can. But this one is just sending everything as strings. Gotta keep an eye on that