playMaker

Author Topic: Sort on multiple dimensions  (Read 172 times)

matthutton

  • Playmaker Newbie
  • *
  • Posts: 9
    • View Profile
Sort on multiple dimensions
« on: October 15, 2019, 11:50:07 AM »
I need to sort on two values. In this case, each user will have a score and a time. I'd like to sort first by their score, and then in the case of ties, by their time. Is that something I can do using hash tables and array lists?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15060
  • Official Playmaker Support
    • View Profile
Re: Sort on multiple dimensions
« Reply #1 on: October 15, 2019, 11:28:03 PM »
Hi,

 yes, you can do that, I would for example do two arrays, one sorted by score and another by time.

 then when you build the final list you go through the score array, and when the same, you can check in the time array and use that order to decide who gets first.

It's cumbersome, I give you that.

Bye,

 Jean