sorting lines by date

JB sundown at pacifier.com
Sat Jul 11 00:27:24 EDT 2020


Another idea might be to save it as seconds and
then convert it to a date when the user needs to
see the date.  That way you would save the time
converting all the dates in each sort.

JB


> On Jul 10, 2020, at 9:02 PM, Tom Glod via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Yeah it will add some overhead, but it will work to do what you need. I'm
> sorry I'm not fluent in the syntax of sort ..... but I knew you can specify
> a date  I never needed to use it.... I always store the seconds or
> milliseconds.
> 
> Yup.....Might as well convert to seconds and then sort numeric ascending or
> descending. Its very fast in my experience.
> 
> All the best.
> 
> Tom
> 
> On Fri, Jul 10, 2020 at 7:55 PM JB via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> 
>> If you are having problems with the date itself not being
>> sorted properly you might be able to accomplish it by
>> first converting the date to seconds and then sort the
>> data.  It will take more time but might work.
>> 
>> JB
>> 
>> 
>>> On Jul 10, 2020, at 3:06 PM, David V Glasgow via use-livecode <
>> use-livecode at lists.runrev.com> wrote:
>>> 
>>> Livecodeistas,
>>> 
>>> I am working with text files consisting of many thousands of lines, most
>> of which are in the format URL & Tab & Date - but a few don’t have a date.
>>> 
>>> So they look like this ...
>>> 
>>> http://1.lw6.blah/b7f3bd9e6b4d728a0f6d5883ed3a5ce/5326d47f?ss=152
>> 17/03/2014 9:55
>>> 
>> http://1.lw6.zdomain/storage/1/x/xk/xkwEp/encoded.mp4/7aecf5e57e34c5f9212f30d0ca16da5a/5326d454?ss=107
>> 
>>> 
>> http://1.lw6.zdomain/storage/1/x/xk/xkwEp/encoded.mp4/7aecf5e57e34c5f9212f30d0ca16da5a/5326d454?ss=107
>> 
>>> 
>> http://1.lw6.zdomain/storage/1/x/xk/xkwEp/encoded.mp4/7aecf5e57e34c5f9212f30d0ca16da5a/5326d454?ss=107
>> 
>>> http://adomain/       27/06/2016 8:10
>>> http://adomain/       27/06/2016 8:10
>>> http://adomain/       27/06/2016 8:10
>>> http://adomain/       27/06/2016 8:10
>>> 
>> http://adomain/?go=click&c=133&n=1&e=0&g=3&r=3841375&u=http%253A%252F%252Fadomain%somestuff-330835.html
>>     17/11/2013 22:18
>>> 
>> http://adomain/?go=click&c=133&n=1&e=0&g=3&r=3841375&u=http%253A%252F%252Fadomain%somestuff-330835.html
>>     17/11/2013 22:18
>>> 
>> http://adomain/?go=click&c=133&n=1&e=0&g=3&r=3841375&u=http%253A%252F%252Fadomain%somestuff-330835.html
>>     17/11/2013 22:18
>>> 
>> http://adomain/?go=click&c=133&n=1&e=0&g=3&r=3841375&u=http%253A%252F%252Fadomain%somestuff-330835.html
>>     17/11/2013 22:18
>>> 
>> http://adomain/?go=click&c=133&n=1&e=0&g=3&r=3841375&u=http%253A%252F%252Fadomain%somestuff-330835.html
>>     17/11/2013 22:18
>>> 
>>> I assumed I could sort the lines by date using the following:
>>> 
>>> set itemdel to tab
>>> sort lines of field "import" datetime by the last item of each
>>> 
>>> (I know I could speed this up using a variable, but I wanted to just see
>> the result first.)
>>> 
>>> I wasn’t sure what would happen to the lines with no date, but assumed
>> they would pile up at the beginning or the end of the field (which would be
>> fine).  However, what happens is that the script runs, and the order above
>> is generated.  I can’t see any meaningful ordering of the lines.
>>> 
>>> I have a horrible feeling that dates are more complicated than I
>> imagined, although I am sort of hoping  there something simple I just
>> haven’t grasped.  If so, what?
>>> 
>>> Best wishes,
>>> 
>>> David Glasgow
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> 
> 
> -- 
> Tom Glod
> Founder & Developer
> MakeShyft R.D.A (www.makeshyft.com)
> Mobile:647.562.9411
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list