Bizarre Number Sort of Files Mac
brahma at hindu.org
Sun Mar 11 05:26:24 CET 2018
Well the dictionary has this cryptic entry
"If you don't specify a sortType, the sortType is text.
I thought, wrongly so, sort alpha text, ascending, was the default
sort line fld "imageIist" # would get you want
But the solution was simple
sort lines fld "imageList" ascending text # this gets want I need
So, the default is mysterious; but, explicitly call, will work.
Bob Sneidar wrote:
Hmmm... I ran into this a few days ago. If you sort numeric, and any of the values are not numeric, the sort fails silently. I would have expected it to sort with the affinity for numeric, but that apparently is not how the sort command works. If you were to simply sort without the numeric arguement, it would work, since your filenames are already padded with zeros. If this needs to work with *any* file list, I think you may be in trouble.
One option would be to iterate in a repeat loop through each line, then iterate through each character, adding the current character to a value then checking if the value is a number. When it's not, put char 1 to -2 of the value into item 1 of a new list, the actual filename into item 2 of the new list, sort lines of <list> numeric ascending by item 1 of each, then iterate through the lies again, putting item 2 of each line in a new list.
You could create a function that does this.
>On Mar 9, 2018, at 10:46 , PEL via use-livecode <use-livecode at lists.runrev.com> wrote:
>When you add text to a number, it ceases to be a number.
>If you had a space between 01-11-04-09-_2018 and the rest of the line you might be able to
>sort lines of field “TheFiles” dateTime ascending by word one of each
More information about the use-livecode