Sortlist Question
hegedus
Hi,
Question about sortlist so I understand:
My List, (fred):
20201119-1.csv;20201119-3.csv;20201119-2.csv;20201119-6.csv;20201119-7.csv;20201119-5.csv;20201119-4.csv;20201119-10.csv;20201119-11.csv;20201119-9.csv;20201119-8.csv;
•sortlist(fred,";",16) yields 20201119-11.csv;20201119-10.csv;20201119-9.csv;20201119-8.csv;20201119-7.csv;20201119-6.csv;20201119-5.csv;20201119-4.csv;20201119-3.csv;20201119-2.csv;20201119-1.csv;
Note that 20201119-11.csv comes before 20201119-10 and 20201119-1.csv is last
sortlist(fred,";",16+1) yields
20201119-1.csv;20201119-2.csv;20201119-3.csv;20201119-4.csv;20201119-5.csv;20201119-6.csv;20201119-7.csv;20201119-8.csv;20201119-9.csv;20201119-10.csv;20201119-11.csv;
Returns the order that I originally anticipated but the +1 option is defined as descending sort. I looked up the definition of descending and am now confused. Why didn't the option of 16 provide the ascending sort?
Andy
The alphanumeric sort (option = 16) sees "-11" as minus eleven., and in fact, -11 comes before -10 in numerical order. When I added the alphanumeric sort, I had two use cases in mind:
1) wave2 should sort before wave12
2) Some of us like to code information about conditions into the wave name, like maybe some input parameter, so I decided that a hyphen should be interpreted as a minus sign instead of simply a separator. You will find that 'wave1.1' sorts before 'wave10', also. Think floating-point numbers.
November 20, 2020 at 11:49 am - Permalink
Igor is looking at the second numbers as negative values.
Use 16+64 for the options:
November 20, 2020 at 12:29 pm - Permalink
Hi,
Thank you for the clarification.
Andy
November 20, 2020 at 12:41 pm - Permalink