sort dateTime problem

Jim Ault JimAultWins at yahoo.com
Fri Dec 16 02:24:23 EST 2005


On 12/15/05 6:55 PM, "Timothy Miller" <gandalf at doctorTimothyMiller.com>
wrote:

> If I use a simple script in button or msg box, then converting
> "4/19/05" to seconds produces the same value as converting
> "<spacebar>4/19/05" to seconds.
> 
> OTOH, if a script with a repeat loop converts several words, items,
> or lines, one at a time, from short date to seconds, a leading
> spacebar character in the short date produces incorrect results.
> 
> That doesn't seem right, does it? Okay, I'll reproduce it more
> carefully, just to be sure.
> 
> This seems like a flaw in the way Rev interprets certain dates, under
> certain circumstances.
You need to remember that testing in a message box as one line or multi-line
will at times produce different results than a script container.  One
immediate difference is that comments "--" are not accepted.

The message stack is just that.. a stack.  I think when we use the message
box, we are using a field to enter the string (eg "put the short name of
this stack" ) and that string is 'interpreted' then executed.  I could be
wrong about this, but the real test is to use a usual script container.

The added benefit is that you get to debug and use variable watcher to check
all the steps.  We all develop our bag of tricks, but beware of assumptions
and shortcuts.  I frequently copy returned results, etc then paste into a
new BBEdit doc, then turn invisibles+spaces ON.. therefore I see all the
tabs, cr's, spaces, etc that can fool me.

Jim Ault
Las Vegas
>> From: Jim Ault <JimAultWins at ...>
>> Subject: Re: sort dateTime problem
>> Newsgroups: gmane.comp.ide.revolution.user
>> Date: 2005-12-15 04:48:31 GMT (20 hours and 30 minutes ago)
>> 
>> Works here...
>> sort lines of cd field "schedule.2" datetime by item 2 of each
>> 
>> What is the itemDel set to just before this step?
>> Are there any delimiters in what seems to be item 1?
>> Is there any reason the short date is not valid?
>> (eg 13/4/04 does not exist)
>> 
>> Jim Ault
>> Las Vegas
>> 
>> On 12/14/05 4:53 PM, "Timothy Miller" <gandalf at ...>
>> wrote:
>>>  One line of a script I'm working on goes:
>>> 
>>>  sort lines of cd field "schedule.2" datetime by item 2 of each.
>>> 
>>>  Each line has four items. Item 2 consists of dates in short date
>>>  format, e.g., 12/2/04.
>>> 
>>>  All 2005 dates come up in correct sequence, from earliest to latest.
>>>  However, after sorting, 2004 dates *follow* 2005 dates, instead of
>>>  preceding them. That is not a correct sort.
>>> 
>>>  Am I doing something wrong?
> 
> 
> Hey, Jim, thanks.
> 
> If it works on your machine, I suppose I'm doing something wrong. Hmmm...
> 
> I just did quite a bit of haphazard troubleshooting. I isolated the
> problem. The short dates are all preceded by a spacebar character. If
> I remove the spacebar characters, the sort works correctly. This is
> easily reproduced. It doesn't seem to matter whether items, lines or
> words are being sorted.
> 
> I don't know about dates or times in other formats. I don't know
> about more than one spacebar character. I didn't check.
> 
> Further testing shows that, in the problem script, converting a short
> date to seconds, if the short date is preceded by a spacebar
> character, produces a negative number. If the original date is in
> year 2005, the negative seconds covert back to a date in 1950 or so.
> 
> More testing:
> 
> If I use a simple script in button or msg box, then converting
> "4/19/05" to seconds produces the same value as converting
> "<spacebar>4/19/05" to seconds.
> 
> OTOH, if a script with a repeat loop converts several words, items,
> or lines, one at a time, from short date to seconds, a leading
> spacebar character in the short date produces incorrect results.
> 
> That doesn't seem right, does it? Okay, I'll reproduce it more
> carefully, just to be sure.
> 
> Yup, I reproduced it.
> 
> This seems like a flaw in the way Rev interprets certain dates, under
> certain circumstances.
> 
> Comments?
> 
> Cheers,
> 
> 
> Tim
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the use-livecode mailing list