Re: Sort question
Bonjour Yves, I propose this one: put fld fld1 into tText replace slash with space in tText set the itemDel to tab sort lines of tText ascending numeric by word 1 of item 2 of each sort lines of tText ascending numeric by word 2 of item 2 of each replace space with slash in tText put tText into fld fld2 -- or fld1 as well of course Best regards from Grenoble André Le 3 oct. 10 à 15:57, Yves COPPE a écrit : Hi list I have a list of lines each line has a first name tab a date (French format : DD/MM/) I want to sort the list on the DD/MM date without taking the into account Here a sample : Jean13/01/2017 Luc 03/07/2017 Bern02/09/2015 Michel 06/01/2018 Bert01/06/2016 Jo 13/02/2016 Rob 26/03/2018 Nick15/01/2015 gives Michel 06/01/2018 Jean13/01/2017 Nick15/01/2015 Jo 13/02/2016 Rob 26/03/2018 Bert01/06/2016 Luc 03/07/2017 Bern02/09/2015 Can someone help me to to that ? Thanks. Amicalement. Yves COPPE yvesco...@skynet.be Greetings. Yves COPPE yvesco...@skynet.be ___ 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: Sort question
Le 4 oct. 10 à 09:18, Andre.Bisseret a écrit : Bonjour Yves, I propose this one: put fld fld1 into tText replace slash with space in tText set the itemDel to tab sort lines of tText ascending numeric by word 1 of item 2 of each sort lines of tText ascending numeric by word 2 of item 2 of each replace space with slash in tText put tText into fld fld2 -- or fld1 as well of course Best regards from Grenoble Hello André, ok, it works fine very easy solution Thanks. (et un grand bonjour de Belgique) Greetings. Yves COPPE yvesco...@skynet.be ___ 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: Sort question
Hi, I finally had a chance to check it. And won't work indeed. You need to use two subsequent sort commands (I know this has been discussed already, I just want to avoid any confusion). -- Best regards, Mark Schonewille Economy-x-Talk Consulting and Software Engineering Homepage: http://economy-x-talk.com Twitter: http://twitter.com/xtalkprogrammer KvK: 50277553 Download the Installer Maker plugin for Runtime Revolution at http://qurl.tk/ce Create installers for Mac and Windows on *every* Rev-compatible platform. No additional software needed. On 3 okt 2010, at 17:08, Mark Schonewille wrote: Hi, won't always workshop corrector. Probably you neef to use 'and' and sort numeric. ___ 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: Sort question
This does a stable sort as required. One sort line. on mouseUp put yourData into temp set the itemdel to / sort lines of temp numeric by item 2 of each char -2 to -1 of item 1 of each answer temp end mouseUp It cheats a bit in that it expects the data to be in a format it likes. But the multiple stable sort is a great tool. Craig Newman ___ 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: Sort question
Hi Yves, What about this: set the itemDel to slash sort lines of myList by item 2 of (word 2 of each) and item 1 of (word 2 of each) -- Economy-x-Talk Consultancy and Software Engineering http://economy-x-talk.com http://www.salery.biz Get your store on-line within minutes with Salery Web Store software. Download at http://www.salery.biz Op 3-okt-2010, om 15:57 heeft Yves COPPE het volgende geschreven: Hi list I have a list of lines each line has a first name tab a date (French format : DD/MM/) I want to sort the list on the DD/MM date without taking the into account Here a sample : Jean13/01/2017 Luc 03/07/2017 Bern02/09/2015 Michel 06/01/2018 Bert01/06/2016 Jo 13/02/2016 Rob 26/03/2018 Nick15/01/2015 gives Michel 06/01/2018 Jean13/01/2017 Nick15/01/2015 Jo 13/02/2016 Rob 26/03/2018 Bert01/06/2016 Luc 03/07/2017 Bern02/09/2015 Can someone help me to to that ? Thanks. Amicalement. Yves COPPE yvesco...@skynet.be ___ 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: Sort question
Le 03-oct.-10 à 16:04, Mark Schonewille a écrit : Hi Yves, What about this: set the itemDel to slash sort lines of myList by item 2 of (word 2 of each) and item 1 of (word 2 of each) Re, No, I don't receive the right answer it gives : Jean13/01/2017 Luc 03/07/2017 Bern02/09/2015 Michel 06/01/2018 Bert01/06/2016 Jo 13/02/2016 Rob 26/03/2018 Nick15/01/2015 but the right answer is : Michel 06/01/2018 Jean13/01/2017 Nick15/01/2015 Jo 13/02/2016 Rob 26/03/2018 Bert01/06/2016 Luc 03/07/2017 Bern02/09/2015 Hi list I have a list of lines each line has a first name tab a date (French format : DD/MM/ ) I want to sort the list on the DD/MM date without taking the into account Here a sample : Jean13/01/2017 Luc 03/07/2017 Bern02/09/2015 Michel 06/01/2018 Bert01/06/2016 Jo 13/02/2016 Rob 26/03/2018 Nick15/01/2015 gives Michel 06/01/2018 Jean13/01/2017 Nick15/01/2015 Jo 13/02/2016 Rob 26/03/2018 Bert01/06/2016 Luc 03/07/2017 Bern02/09/2015 Can someone help me to to that ? Thanks. Amicalement. Yves COPPE yvesco...@skynet.be ___ 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 Amicalement. Yves COPPE yvesco...@skynet.be ___ 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: Sort question
I think that just missed the year... On Sun, Oct 3, 2010 at 10:14 AM, Yves COPPE yvesco...@skynet.be wrote: Le 03-oct.-10 à 16:04, Mark Schonewille a écrit : Hi Yves, What about this: set the itemDel to slash sort lines of myList by item 2 of (word 2 of each) and item 1 of (word 2 of each) Re, No, I don't receive the right answer it gives : Jean13/01/2017 Luc 03/07/2017 Bern02/09/2015 Michel 06/01/2018 Bert01/06/2016 Jo 13/02/2016 Rob 26/03/2018 Nick15/01/2015 but the right answer is : Michel 06/01/2018 Jean13/01/2017 Nick15/01/2015 Jo 13/02/2016 Rob 26/03/2018 Bert01/06/2016 Luc 03/07/2017 Bern02/09/2015 Hi list I have a list of lines each line has a first name tab a date (French format : DD/MM/) I want to sort the list on the DD/MM date without taking the into account Here a sample : Jean13/01/2017 Luc 03/07/2017 Bern02/09/2015 Michel 06/01/2018 Bert01/06/2016 Jo 13/02/2016 Rob 26/03/2018 Nick15/01/2015 gives Michel 06/01/2018 Jean13/01/2017 Nick15/01/2015 Jo 13/02/2016 Rob 26/03/2018 Bert01/06/2016 Luc 03/07/2017 Bern02/09/2015 Can someone help me to to that ? Thanks. Amicalement. Yves COPPE yvesco...@skynet.be ___ 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 Amicalement. Yves COPPE yvesco...@skynet.be ___ 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: Sort question
Use the technique of sorting by a function call for each line to set a value. on testSort put the clipboarddata into theListOfFriends sort theListOfFriends numeric ascending by sortByThisValue(each) ;put theListOfFriends end testSort function sortByThisValue singleLineOfList set the itemdel to / get word 2 of item 1 of singleLineOfList / item 2 of singleLineOfList / 01 --English system -- remove the next line get item 2 of singleLineOfList / word 2 of item 1 of singleLineOfList / 01 convert IT to seconds return IT end sortByThisValue This should do the task you want On Oct 3, 2010, at 6:57 AM, Yves COPPE wrote: Hi list I have a list of lines each line has a first name tab a date (French format : DD/MM/) I want to sort the list on the DD/MM date without taking the into account Here a sample : Jean13/01/2017 Luc 03/07/2017 Bern02/09/2015 Michel 06/01/2018 Bert01/06/2016 Jo 13/02/2016 Rob 26/03/2018 Nick15/01/2015 gives Michel 06/01/2018 Jean13/01/2017 Nick15/01/2015 Jo 13/02/2016 Rob 26/03/2018 Bert01/06/2016 Luc 03/07/2017 Bern02/09/2015 Can someone help me to to that ? Jim Ault Las Vegas ___ 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: Sort question
This is really the same as Mark suggested, but should work even if the numbers aren't zero padded: function sortByMonthAndDay tText set the itemDelimiter to / sort lines of tText ascending numeric by item 1 of (word 2 of each) sort lines of tText ascending numeric by item 2 of (word 2 of each) return tText end mouseUp (I think Mark probably meant instead of and) Ben On 03/10/2010 15:14, Yves COPPE wrote: Le 03-oct.-10 à 16:04, Mark Schonewille a écrit : Hi Yves, What about this: set the itemDel to slash sort lines of myList by item 2 of (word 2 of each) and item 1 of (word 2 of each) Re, No, I don't receive the right answer ___ 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: Sort question
Le 03-oct.-10 à 16:31, Jim Ault a écrit : Use the technique of sorting by a function call for each line to set a value. on testSort put the clipboarddata into theListOfFriends sort theListOfFriends numeric ascending by sortByThisValue(each) ;put theListOfFriends end testSort function sortByThisValue singleLineOfList set the itemdel to / get word 2 of item 1 of singleLineOfList / item 2 of singleLineOfList / 01 --English system -- remove the next line get item 2 of singleLineOfList / word 2 of item 1 of singleLineOfList / 01 convert IT to seconds return IT end sortByThisValue This should do the task you want re, ye !! thank you Greetings. Yves COPPE yvesco...@skynet.be ___ 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: Sort question
Ben, wouldn't yours just end up with it sorted the second way? Mark's does work if you use ___ 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: Sort question
Changing the first suggestion set the itemDel to slash sort lines of myList by item 2 of (word 2 of each) and item 1 of (word 2 of each) to set the itemDel to slash sort lines of myList by item 2 of (word 2 of each) ** item 1 of (word 2 of each) works for this also as long as the data is always 2 digit format. Barring that, just doing 2 consecutive numeric sorts on the appropriate key will work. Can you use the version and specify sort type individually for each part? IE: sort blah blah by item 1 item 2, 1 numeric, the other alphabetic? On Sun, Oct 3, 2010 at 8:32 AM, Ben Rubinstein benr...@cogapp.com wrote: This is really the same as Mark suggested, but should work even if the numbers aren't zero padded: function sortByMonthAndDay tText set the itemDelimiter to / sort lines of tText ascending numeric by item 1 of (word 2 of each) sort lines of tText ascending numeric by item 2 of (word 2 of each) return tText end mouseUp (I think Mark probably meant instead of and) Ben On 03/10/2010 15:14, Yves COPPE wrote: Le 03-oct.-10 à 16:04, Mark Schonewille a écrit : Hi Yves, What about this: set the itemDel to slash sort lines of myList by item 2 of (word 2 of each) and item 1 of (word 2 of each) Re, No, I don't receive the right answer ___ 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: Sort question
Le 03-oct.-10 à 16:32, Ben Rubinstein a écrit : This is really the same as Mark suggested, but should work even if the numbers aren't zero padded: function sortByMonthAndDay tText set the itemDelimiter to / sort lines of tText ascending numeric by item 1 of (word 2 of each) sort lines of tText ascending numeric by item 2 of (word 2 of each) return tText end mouseUp (I think Mark probably meant instead of and) Hi Ben, it works fine !! thank you Greetings. Yves COPPE yvesco...@skynet.be ___ 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: Sort question
Le 03-oct.-10 à 16:32, Ben Rubinstein a écrit : This is really the same as Mark suggested, but should work even if the numbers aren't zero padded: function sortByMonthAndDay tText set the itemDelimiter to / sort lines of tText ascending numeric by item 1 of (word 2 of each) sort lines of tText ascending numeric by item 2 of (word 2 of each) return tText end mouseUp (I think Mark probably meant instead of and) Ben hi Ben I still have a problem some first names have 2 words !!! and the sort is not correct Should it be possible to sort on item 2 (tab delim of the list) and reorder the lsit afterwards ?? Greetings. Yves COPPE yvesco...@skynet.be ___ 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: Sort question
use word -1 of item 1 of blahblah to get the last word On Oct 3, 2010, at 7:43 AM, Yves COPPE wrote: Le 03-oct.-10 à 16:32, Ben Rubinstein a écrit : This is really the same as Mark suggested, but should work even if the numbers aren't zero padded: function sortByMonthAndDay tText set the itemDelimiter to / sort lines of tText ascending numeric by item 1 of (word 2 of each) sort lines of tText ascending numeric by item 2 of (word 2 of each) return tText end mouseUp (I think Mark probably meant instead of and) Ben hi Ben I still have a problem some first names have 2 words !!! and the sort is not correct Should it be possible to sort on item 2 (tab delim of the list) and reorder the lsit afterwards ?? Greetings. Yves COPPE yvesco...@skynet.be ___ 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 Jim Ault Las Vegas ___ 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: Sort question
On Oct 3, 2010, at 10:43 AM, Yves COPPE wrote: some first names have 2 words !!! Go back to using Mark's way, with instead of 'and', and also say 'last word of each' instead of 'word 2 of each'. ___ 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: Sort question
Le 03-oct.-10 à 16:47, Jim Ault a écrit : use word -1 of item 1 of blahblah to get the last word ok thank you Greetings. Yves COPPE yvesco...@skynet.be ___ 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: Sort question
Le 03-oct.-10 à 16:49, Colin Holgate a écrit : ok thank you Greetings. Yves COPPE yvesco...@skynet.be ___ 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: Sort question
Hi, won't always workshop corrector. Probably you neef to use 'and' and sort numeric. -- Kind regards, Mark Schonewille Economy-x-Talk Http://economy-x-talk.com Share the clipboard of your computer over a local network with Clipboard Link http://clipboardlink.economy-x-talk.com Op 3 okt. 2010 om 16:39 heeft Mike Bonner bonnm...@gmail.com het volgende geschreven: Changing the first suggestion set the itemDel to slash sort lines of myList by item 2 of (word 2 of each) and item 1 of (word 2 of each) to set the itemDel to slash sort lines of myList by item 2 of (word 2 of each) ** item 1 of (word 2 of each) works for this also as long as the data is always 2 digit format. Barring that, just doing 2 consecutive numeric sorts on the appropriate key will work. Can you use the version and specify sort type individually for each part? IE: sort blah blah by item 1 item 2, 1 numeric, the other alphabetic? ___ 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: Sort question
On Oct 3, 2010, at 11:08 AM, Mark Schonewille wrote: won't always workshop corrector. Probably you neef to use 'and' and sort numeric. I think your spell checker doesn't alway walk correctly either. ___ 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: Sort question
On 03/10/2010 15:39, Colin Holgate wrote: Ben, wouldn't yours just end up with it sorted the second way? Mark's does work if you use No, because Rev doesn't move lines if they have the same value on the sort expression. So two sort commands in succession have the desired effect - the first establishes a secondary sort, the second imposes the primary sort. Jean13/01/2017 Luc 03/07/2017 Bern02/09/2015 Michel 06/01/2018 Bert01/06/2016 Jo 13/02/2016 Rob 26/03/2018 Nick15/01/2015 is sorted as Michel 06/01/2018 Jean13/01/2017 Nick15/01/2015 Jo 13/02/2016 Rob 26/03/2018 Bert01/06/2016 Luc 03/07/2017 Bern02/09/2015 However as Yves points out it would be better to have replaced word 2 of each with last word of each. Mark's does indeed work (if his fingers hadn't misrepresented what his mind knew) and is probably faster - but depends on having zero padding of the month/date so that alpha sorting will equate to numeric sorting. slogan Rev^H^H^H LiveCode: more ways to skin every cat! Ben ___ 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: Sort question
Oops, that's the iPhone. I meant: won't always work correctly. You need to use 'and' and sort numeric. -- Kind regards, Mark Schonewille Economy-x-Talk Http://economy-x-talk.com Share the clipboard of your computer over a local network with Clipboard Link http://clipboardlink.economy-x-talk.com Op 3 okt. 2010 om 17:09 heeft Colin Holgate co...@verizon.net het volgende geschreven: On Oct 3, 2010, at 11:08 AM, Mark Schonewille wrote: won't always workshop corrector. Probably you neef to use 'and' and sort numeric. I think your spell checker doesn't alway walk correctly either. ___ 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: sort question
answering on top for clarity Yes, Wouter, you are right. Your sort result is true and exactly correct, given the data source. I am also on a Mac, but that should make absolutely no difference. First four sorted values in the output list are 10.101- 11.151- 4.101- 5.101.1- which a TEXT sort, because there is a trailing space on each of these lines, which means that this will not be a good number sort. The answer is to clean the data or adjust the function to handle characters after the - sign. (Beware when positive numbers are used and there is no sign, or there are multiple spaces.) After that, the sorted values are indeed numeric from -20.101 ascending to -1.101 Removing all spaces would give a numeric result using all lines. Adding -(replace with in tSource) should do the trick. So, all is well and functioning with Rev's sort :-) Jim Ault Las Vegas PS The reason 10.101- becomes a text sort is that the parsing function, as I wrote it, will build the following - 10.101 rather than -10.101. Notice the space after the -. (I was not expecting spaces to be there) On 6/3/05 7:33 PM, Wouter [EMAIL PROTECTED] wrote: On 03 Jun 2005, at 20:09, Jim Ault wrote: Greetings, jack snip on sortFldSource put fld source into tSource --lines to sort sort lines of tSource numeric by numberConvert(each) put tSource into fld destination --output for your review end sortFldSource function numberConvert pStrToConvert if pStrToConvert is then return else set itemdel to . if the last char of pStrToConvert is - then put the last char of pStrToConvert into tSign delete the last char of pStrToConvert end if put item 1 of pStrToConvert into tIntPart put item 2 of pStrToConvert into tDecPart1 if the number of items in pStrToConvert 2 then put item 3 of pStrToConvert into tDecPart2 else put into tDecPart2 end if put tSign tIntPart . tDecPart1 tDecPart2 into tReply return tReply end if end numberConvert Thanks to jeanne a. e. devoto for this (each) form of the sort lines of command. Jim Ault Las Vegas On 6/3/05 9:45 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi Jim, I don't know on your computer but on my mac this handler gives the following result for Jack's list: 10.101- 11.151- 4.101- 5.101.1- 20.101- 11.101.1- 10.501- 10.401- 10.351- 10.301.1- 10.201- 9.351- 9.101.1- 8.301- 8.101- 7.501.1- 7.401- 7.251- 7.201.1- 7.151.1- 7.101- 6.401.1- 6.301- 6.201.1- 6.101.1- 5.701- 5.651- 5.501- 5.451- 5.401- 5.351.1- 5.301- 5.201- 5.151- 4.991- 3.101- 2.301- 2.101- 1.101- --snip -- Greetings, Wouter ___ use-revolution mailing list use-revolution@lists.runrev.com http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com http://lists.runrev.com/mailman/listinfo/use-revolution
Re: sort question
Hi Jack, You could do for example: on mouseUp get field 1 sort it set the itemdelimiter to . sort lines of it numeric ascending by item 1 of each put it into fld 2 end mouseUp Greetings, Wouter On 03 Jun 2005, at 18:45, [EMAIL PROTECTED] wrote: Greetings, I need a field to sort numerically and when I try it I get the result below. I checked the docs and experimented with the numberformat without success. Help! jack 1.101- 10.101- 10.201- 10.301.1- 10.351- 10.401- 10.501- 11.101.1- 11.151- 2.101- 2.301- 20.101- 3.101- 4.101- 4.991- 5.101.1- 5.151- 5.201- 5.301- 5.351.1- 5.401- 5.451- 5.501- 5.651- 5.701- 6.101.1- 6.201.1- 6.301- 6.401.1- 7.101- 7.151.1- 7.201.1- 7.251- 7.401- 7.501.1- 8.101- 8.301- 9.101.1- 9.351- ___ use-revolution mailing list use-revolution@lists.runrev.com http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com http://lists.runrev.com/mailman/listinfo/use-revolution
Re: sort question
Greetings, jack First point is that these are not numbers, so numeric has no meaning. These are text strings and are sorted as such. You also have some lines with trailing spaces. You need to clean these up some how to make the sorting work as you wish. Try converting these strings to a number format by using a technique of sorting 'each' line This is a bit confusing when you first attempt it, but hang in there because it is really a valuable tool. 1) syntaxsort lines of strList numeric by numberVersion(each) each tells Rev to send each line to a function to be converted *before* sorting 2) now the function that creates a number from the string (for each line of the strList), and subsequently sorts that number list, giving back the original strList in the new sort order based on the numbers. on sortFldSource put fld source into tSource --lines to sort sort lines of tSource numeric by numberConvert(each) put tSource into fld destination --output for your review end sortFldSource function numberConvert pStrToConvert if pStrToConvert is then return else set itemdel to . if the last char of pStrToConvert is - then put the last char of pStrToConvert into tSign delete the last char of pStrToConvert end if put item 1 of pStrToConvert into tIntPart put item 2 of pStrToConvert into tDecPart1 if the number of items in pStrToConvert 2 then put item 3 of pStrToConvert into tDecPart2 else put into tDecPart2 end if put tSign tIntPart . tDecPart1 tDecPart2 into tReply return tReply end if end numberConvert Thanks to jeanne a. e. devoto for this (each) form of the sort lines of command. Jim Ault Las Vegas On 6/3/05 9:45 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Greetings, I need a field to sort numerically and when I try it I get the result below. I checked the docs and experimented with the numberformat without success. Help! jack 1.101- 10.101- 10.201- 10.301.1- 10.351- 10.401- 10.501- 11.101.1- 11.151- 2.101- 2.301- 20.101- 3.101- 4.101- 4.991- 5.101.1- 5.151- 5.201- 5.301- 5.351.1- 5.401- 5.451- 5.501- 5.651- 5.701- 6.101.1- 6.201.1- 6.301- 6.401.1- 7.101- 7.151.1- 7.201.1- 7.251- 7.401- 7.501.1- 8.101- 8.301- 9.101.1- 9.351- ___ use-revolution mailing list use-revolution@lists.runrev.com http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com http://lists.runrev.com/mailman/listinfo/use-revolution
RE: sort question
set the itemdelimiter to . sort lines of mylist numeric by item 2 of each sort lines of mylist numeric by item 1 of each or you decimal places will not be sorted right but a simple sort lines of mylist numeric by word 1 of each would sufice ;) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jim Ault Sent: Friday, June 03, 2005 20:10 To: How to use Revolution Subject: Re: sort question Greetings, jack First point is that these are not numbers, so numeric has no meaning. These are text strings and are sorted as such. You also have some lines with trailing spaces. You need to clean these up some how to make the sorting work as you wish. Try converting these strings to a number format by using a technique of sorting 'each' line This is a bit confusing when you first attempt it, but hang in there because it is really a valuable tool. 1) syntaxsort lines of strList numeric by numberVersion(each) each tells Rev to send each line to a function to be converted *before* sorting 2) now the function that creates a number from the string (for each line of the strList), and subsequently sorts that number list, giving back the original strList in the new sort order based on the numbers. on sortFldSource put fld source into tSource --lines to sort sort lines of tSource numeric by numberConvert(each) put tSource into fld destination --output for your review end sortFldSource function numberConvert pStrToConvert if pStrToConvert is then return else set itemdel to . if the last char of pStrToConvert is - then put the last char of pStrToConvert into tSign delete the last char of pStrToConvert end if put item 1 of pStrToConvert into tIntPart put item 2 of pStrToConvert into tDecPart1 if the number of items in pStrToConvert 2 then put item 3 of pStrToConvert into tDecPart2 else put into tDecPart2 end if put tSign tIntPart . tDecPart1 tDecPart2 into tReply return tReply end if end numberConvert Thanks to jeanne a. e. devoto for this (each) form of the sort lines of command. Jim Ault Las Vegas On 6/3/05 9:45 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Greetings, I need a field to sort numerically and when I try it I get the result below. I checked the docs and experimented with the numberformat without success. Help! jack 1.101- 10.101- 10.201- 10.301.1- 10.351- 10.401- 10.501- 11.101.1- 11.151- 2.101- 2.301- 20.101- 3.101- 4.101- 4.991- 5.101.1- 5.151- 5.201- 5.301- 5.351.1- 5.401- 5.451- 5.501- 5.651- 5.701- 6.101.1- 6.201.1- 6.301- 6.401.1- 7.101- 7.151.1- 7.201.1- 7.251- 7.401- 7.501.1- 8.101- 8.301- 9.101.1- 9.351- ___ use-revolution mailing list use-revolution@lists.runrev.com http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com http://lists.runrev.com/mailman/listinfo/use-revolution
Re: sort question
Jack, 1. Open a new stack, place 2 scrolling fields and 1 button Modify_Sort on it 2. Copy (cut paste) your data into fld 1 - must be 1 number/line 3. Copy the following script into your Midify_Sort button on mouseUp -- by Ralph forehand 06/03/05 -- inset leading 0s into numers where needed put empty into card field 2 repeat with i = 1 to number of lines in fld 1 put line i of fld 1 into myNumber if char 2 of myNumber =. then put 0 myNumber into line i of fld 2 else put myNumber into line i of fld 2 end if end repeat -- sort modified numbers sort cd fld 2 -- Remove leading Zeros returning numbers to original form repeat with i = 1 to number of lines in fld 2 put line i of fld 2 into myNumber if char 1 of myNumber = 0 then put char 2 to 12 of myNumber into line i of fld 2 else put myNumber into line i of fld 2 end if end repeat end mouseUp 4. Button will put your numbers in the right order. Trust the above helps and Good Luck, Ralph Greetings, I need a field to sort numerically and when I try it I get the result below. I checked the docs and experimented with the numberformat without success. Help! jack 1.101- 10.101- 10.201- 10.301.1- 10.351- 10.401- 10.501- 11.101.1- 11.151- 2.101- 2.301- 20.101- 3.101- 4.101- 4.991- 5.101.1- 5.151- 5.201- 5.301- 5.351.1- 5.401- 5.451- 5.501- 5.651- 5.701- 6.101.1- 6.201.1- 6.301- 6.401.1- 7.101- 7.151.1- 7.201.1- 7.251- 7.401- 7.501.1- 8.101- 8.301- 9.101.1- 9.351- ___ use-revolution mailing list use-revolution@lists.runrev.com http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com http://lists.runrev.com/mailman/listinfo/use-revolution
Re: sort question
On 03 Jun 2005, at 20:09, Jim Ault wrote: Greetings, jack snip on sortFldSource put fld source into tSource --lines to sort sort lines of tSource numeric by numberConvert(each) put tSource into fld destination --output for your review end sortFldSource function numberConvert pStrToConvert if pStrToConvert is then return else set itemdel to . if the last char of pStrToConvert is - then put the last char of pStrToConvert into tSign delete the last char of pStrToConvert end if put item 1 of pStrToConvert into tIntPart put item 2 of pStrToConvert into tDecPart1 if the number of items in pStrToConvert 2 then put item 3 of pStrToConvert into tDecPart2 else put into tDecPart2 end if put tSign tIntPart . tDecPart1 tDecPart2 into tReply return tReply end if end numberConvert Thanks to jeanne a. e. devoto for this (each) form of the sort lines of command. Jim Ault Las Vegas On 6/3/05 9:45 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi Jim, I don't know on your computer but on my mac this handler gives the following result for Jack's list: 10.101- 11.151- 4.101- 5.101.1- 20.101- 11.101.1- 10.501- 10.401- 10.351- 10.301.1- 10.201- 9.351- 9.101.1- 8.301- 8.101- 7.501.1- 7.401- 7.251- 7.201.1- 7.151.1- 7.101- 6.401.1- 6.301- 6.201.1- 6.101.1- 5.701- 5.651- 5.501- 5.451- 5.401- 5.351.1- 5.301- 5.201- 5.151- 4.991- 3.101- 2.301- 2.101- 1.101- To make it more universal (no matter leading or trailing - and +) one could change it to: on mouseUp get field 1 put numsort(it,ascending) into fld 2 end mouseUp function numSort pList,pDirection set the itemdelimiter to . repeat for each line i in pList put i into x if char -1 of word 1 of i is in -+ then put char -1 of word 1 of i char 1 to -2 of word 1 of i into x if the num of items in x 2 then put item 1 to 2 of x item 3 of x into x put i into numArray[x] end repeat put the keys of numArray into y if pDirection = ascending then sort lines of y numeric ascending else sort lines of y numeric descending repeat for each line i in y put numArray[i] cr after tList end repeat return tList end numSort Greetings, Wouter ___ use-revolution mailing list use-revolution@lists.runrev.com http://lists.runrev.com/mailman/listinfo/use-revolution