Re: sorting advice

2009-06-21 Thread Kay C Lan
On Sun, Jun 21, 2009 at 8:10 AM, Nicolas Cueto nicon...@gmail.com wrote:


 My mistake (again), Kay. Your method
 does work. The problem at my end
 was my test-data, which included a
 miscalculated leap year date of 2.29.09
 -- an impossible date.


I'm fluent in mistakes as well :-) Much better at them than Rev so I'm glad
no bug with Rev and you were able to get a workable solution.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: sorting advice

2009-06-20 Thread Nicolas Cueto
 Tried it and, no, doesn't sort as expected.

 Please explain further.

My mistake (again), Kay. Your method
does work. The problem at my end
was my test-data, which included a
miscalculated leap year date of 2.29.09
-- an impossible date.

Again, thank you.

--
Nicolas Cueto
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: sorting advice

2009-06-19 Thread Kay C Lan
On Fri, Jun 19, 2009 at 1:56 PM, Nicolas Cueto nicon...@gmail.com wrote:

 Well, I found a solution. But maybe
 someone's got something more
 elegant.


How about:

replace .  with / in tNaiyo
  sort lines of tNaiyo ascending dateTime by word 2 of each
replace / with . in tNaiyo

HTH
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: sorting advice

2009-06-19 Thread Nicolas Cueto
 How about:

 replace .  with / in tNaiyo
  sort lines of tNaiyo ascending dateTime by word 2 of each
 replace / with . in tNaiyo

Tried it and, no, doesn't sort as expected.

Thanks all the same.

--
Nicolas Cueto
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: sorting advice

2009-06-19 Thread Jan Schenkel

Hi Nicolas,

Custom sort functions to the rescue!

I made a simple stack with 2 fields and a button. The first field contains your 
original data, and the button has the following script:
##
on mouseUp
   put field 1 into tData
   sort tData ascending by MyCustomSort(each)
   put tData into field 2
end mouseUp

function MyCustomSort pLine
   set the itemDelimiter to space
   put item 2 of pLine into tDate
   replace .. with / in tDate
   convert tDate from english date to dateItems
   set the itemDelimiter to comma
   put format(%4u%02u%02u, \
item 1 of tDate, \
item 2 of tDate, \
item 3 of tDate) into tSortableDate
   return tSortableDate
end MyCustomSort
##

Clicking the button produced the expected results in field 2.

The trick is to return from your function a value that will sort the content 
correctly. In this case, the function will turn 12.3.09 into 20091203, 3.2.04 
into 20040302, etc. And those 'MMDD' versions of the date will sort 
correctly.

HTH,

Jan Schenkel
=
Quartam Reports  PDF Library for Revolution
http://www.quartam.com

=
As we grow older, we grow both wiser and more foolish at the same time.  (La 
Rochefoucauld)


--- On Thu, 6/18/09, Nicolas Cueto nicon...@gmail.com wrote:

 From: Nicolas Cueto nicon...@gmail.com
 Subject: sorting advice
 To: How to use Revolution use-revolution@lists.runrev.com
 Date: Thursday, June 18, 2009, 10:23 PM
 Still avoiding thinking too much...
 
 Given this list (a ref-number followed
 by a dot-separated date):
 
  bg2334 12.21.09
  bg9788 1.10.02
  bg6554 11.30.11
  bg8902 6.6.04
  bg4021 2.29.12
  bg1210 1.2.02
  bg3008 12.3.09
  bg5526 5.29.04
 
 what sort-command combo would
 re-order it ascending by the date
 to become:
 
   bg1210 1.2.02
   bg9788 1.10.02
   bg5526 5.29.04
   bg8902 6.6.04
   bg3008 12.3.09
   bg2334 12.21.09
   bg6554 11.30.11
   bg4021 2.29.12
 
 
 Note that the ref-number and the date
 are space-separated, and I'm using
 . instead of the english date's /.
 Also, the date form is month[1-12,
 no leading zero], day[1-31], year [00-
 09, leading zero].
 
 I'll be experimenting on my own to hit on
 the magic combination, but in the meantime
 I thought I'd post a plea since someone is
 very likely to reply a solution sooner than I
 can guess one up.
 
 Thank you.
 
 --
 Nicolas Cueto
 ___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage
 your subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution
 




___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: sorting advice

2009-06-19 Thread Mark Smith

Nicolas, this might a good case for using a custom sort like:

on mouseUp
   put fld 1 into tData
   sort lines of tData dateTime by toDate(word 2 of each)
   put tData
end mouseUp

function toDate pStr
   replace . with / in pStr
   return pStr
end toDate

Best,

Mark Smith

On 19 Jun 2009, at 06:23, Nicolas Cueto wrote:


Still avoiding thinking too much...

Given this list (a ref-number followed
by a dot-separated date):

 bg2334 12.21.09
 bg9788 1.10.02
 bg6554 11.30.11
 bg8902 6.6.04
 bg4021 2.29.12
 bg1210 1.2.02
 bg3008 12.3.09
 bg5526 5.29.04

what sort-command combo would
re-order it ascending by the date
to become:

  bg1210 1.2.02
  bg9788 1.10.02
  bg5526 5.29.04
  bg8902 6.6.04
  bg3008 12.3.09
  bg2334 12.21.09
  bg6554 11.30.11
  bg4021 2.29.12


Note that the ref-number and the date
are space-separated, and I'm using
. instead of the english date's /.
Also, the date form is month[1-12,
no leading zero], day[1-31], year [00-
09, leading zero].

I'll be experimenting on my own to hit on
the magic combination, but in the meantime
I thought I'd post a plea since someone is
very likely to reply a solution sooner than I
can guess one up.

Thank you.

--
Nicolas Cueto
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your  
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: sorting advice

2009-06-19 Thread Kay C Lan
On Fri, Jun 19, 2009 at 4:26 PM, Nicolas Cueto nicon...@gmail.com wrote:

  How about:
 
  replace .  with / in tNaiyo
   sort lines of tNaiyo ascending dateTime by word 2 of each
  replace / with . in tNaiyo

 Tried it and, no, doesn't sort as expected.


Please explain further.

Using the data you provided I got exactly the same result you wanted as
specified in your first post! If you got the right result for your example,
but a different result with different data then could you provide examples
of where the sort goes wrong so I can see how to account for the different
data.

On the other hand, if using the data you supplied you get a different answer
to the one you supplied then there must be a bug somewhere. Why would my
system correctly sort by dateTime and yours not. If this is the case then
either it's a bug with Rev, and should be reported, or a 'feature' of Rev
which needs to be noted; ie, on particular operating systems with particular
system languages the sort by dateTime may not work.

So we need to know why your sort doesn't work

Thanks
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


sorting advice

2009-06-18 Thread Nicolas Cueto
Still avoiding thinking too much...

Given this list (a ref-number followed
by a dot-separated date):

 bg2334 12.21.09
 bg9788 1.10.02
 bg6554 11.30.11
 bg8902 6.6.04
 bg4021 2.29.12
 bg1210 1.2.02
 bg3008 12.3.09
 bg5526 5.29.04

what sort-command combo would
re-order it ascending by the date
to become:

  bg1210 1.2.02
  bg9788 1.10.02
  bg5526 5.29.04
  bg8902 6.6.04
  bg3008 12.3.09
  bg2334 12.21.09
  bg6554 11.30.11
  bg4021 2.29.12


Note that the ref-number and the date
are space-separated, and I'm using
. instead of the english date's /.
Also, the date form is month[1-12,
no leading zero], day[1-31], year [00-
09, leading zero].

I'll be experimenting on my own to hit on
the magic combination, but in the meantime
I thought I'd post a plea since someone is
very likely to reply a solution sooner than I
can guess one up.

Thank you.

--
Nicolas Cueto
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: sorting advice

2009-06-18 Thread Nicolas Cueto
Well, I found a solution. But maybe
someone's got something more
elegant.

Here's mine:

repeat for each line tLine in tNaiyo -- the list of data, unsorted
put word 2 of tLine  word 1 of tLine  cr after tSwitched
end repeat
delete the last char of tSwitched
put tSwitched into tNaiyo
put the itemdel into tSavedDel
set the itemdel to .
sort lines of tNaiyo ascending numeric by item 2 of each
sort lines of tNaiyo ascending numeric by item 1 of each
sort lines of tNaiyo ascending numeric by item 3 of each
put empty into tSwitched
repeat for each line tLine in tNaiyo
put word 2 of tLine  word 1 of tLine  cr after tSwitched
end repeat
delete the last char of tSwitched
put tSwitched into tNaiyo -- the list of data, sorted by date
set the itemdel to tSavedDel

Cheers,
Nicolas Cueto
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution