PricingBlog

Sorting data

  • lukasmohr-1209515159329185852

    Lukas Mohr

    2 years ago

    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?
    1209515160528617522-image.png
    1
  • andreasmoller-1209515559352537168

    Andreas Møller

    2 years ago

    If you give the sort formula an array as second input it will sort based on priority
  • lukasmohr-1209516553226428486

    Lukas Mohr

    2 years ago

    Inbetween the API and the Sort by?
  • andreasmoller-1209516947843186729

    Andreas Møller

    2 years 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
  • andreasmoller-1209517530348261397

    Andreas Møller

    2 years ago

    Does that make sense?
  • lukasmohr-1209517780320256041

    Lukas Mohr

    2 years ago

    {{ total_races, races_won, top_three_finishes }} like this?
  • lukasmohr-1209518132511772752

    Lukas Mohr

    2 years ago

    Maybe I got it
    1209518132268634201-image.png
  • lukasmohr-1209519658483318784

    Lukas Mohr

    2 years ago

    But not working as inteded.
  • andreasmoller-1209520321242202153

    Andreas Møller

    2 years 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
  • lukasmohr-1209523950665605180

    Lukas Mohr

    2 years ago

    Very easy then! Many thanks 😄
  • nocode.lad-1210152480118145074

    noCode.Lad

    2 years ago

    I learnt something here today. Many thanks
  • xioteer-1249699869992681504

    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-1249797940185272320

    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
    1249797940004913332-image.png
  • andreasmoller-1249798352489545749

    Andreas Møller

    1 year ago

    Ill take a look
    🙌1
  • 282143925291057163-@Andreas Møller
    Ill take a look
    xioteer-1249800507736981664

    Xioteer

    1 year ago

    Stop looking
  • It was a string
    1249800532642500648-image.png
  • Switched to number and it obviously worked
  • xioteer-1249800782174490624

    Xioteer

    1 year ago

    That's the only thing that remains, basically that the second/third sorting can have a different direction to the main one
  • andreasmoller-1249804303837827143

    Andreas Møller

    1 year ago

    That was my guess, but i wasn't going to assume 🙂
  • I have made that mistake so many times 🤣
  • xioteer-1249805118874976286

    Xioteer

    1 year ago

    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