|
-
using sortOn on Arrays [ASCENDING, DESCENDING]
how do I get the sortOn function for an Array to support BOTH the NUMERIC and ASCENDING sort orders? DESCENDING seems to be the default or something.
I have 5 fields, all NUMERIC and I want to sort the first by DESCENDING, 2nd field is ASCENDING, 3rd field DESCENDING, 4th field DESCENDING, 5th field ASCENDING.....how do I achieve this?
this is for a league standings list, so wins is DESCENDING, losses ASCENDING, ties DESCENDING, points scored is DESCENDING, and points scored against is ASCENDING.....just to give you an idea.
-
I'm sure someone has run into this? sortOn is very useful and saved me a lot of time, but I need to tweak it!
-
In the Array livedoc for sortOn:
To pass multiple flags, separate them with the bitwise OR (|) operator:
Code:
my_array.sortOn(someFieldName, Array.DESCENDING | Array.NUMERIC);
-
is ASCENDING the default because it's not in the list? I need that...thx!
-
I've just done an experiment that shows that, yes, ascending is the default.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|