sorting lines by date

Curry Kenworthy curry at
Sat Jul 11 14:06:50 EDT 2020

Like everything field and text related, this thread caught my eye! :)

One of my favorite areas of LiveCode, and also one of the areas I have 
to actively keep an eye on since I rely on it a lot.

Here's an observation that might help in one way or another....


 > http://adomain/	27/06/2016 8:10

 > set itemdel to tab
 > sort lines of field "import" datetime by the last item of each

 > the order above is generated.
 > I can’t see any meaningful ordering of the lines.

I was curious and copied your content into a field where I changed the 
date format of the dates, like so:

http://adomain/	06/27/2016 8:10
http://adomain/	11/17/2013 22:18

And for me, over here on this side of the ocean (cue Trump rally: USA! 
USA!) that both looks good, and works well, using your unmodified code. 
The lines without a date also stacked up at the top, as you predicted, 
and as I know to be the normal LC sort behavior.

I realize you need the British format, but again out of curiosity and to 
make sure everything LC datewise is working properly, you might try your 
sort again, with a few lines of your content and that modification.

(There is also a useSystemDate keyword that you could test.)

Regardless, be assured that ABSOLUTELY it is possible to have datetime 
sorts working well in fields or text with tabbed columns. Have no doubts 
or fears in that regard. I very recently delivered a client project, 
this year, with that feature.

The only question is efficiency. It would be better and faster to get 
the datetime sort working directly with your content.

But if not, you can also sort with a custom function, and then the sky 
is the limit! LC sort really is powerful and flexible.

But I would like to know the outcome, so when this is resolved, thanks 
in advance for posting again to let us know what worked!

Best wishes,

Curry Kenworthy

Custom Software Development
"Better Methods, Better Results"
LiveCode Training and Consulting

More information about the use-livecode mailing list