Re: sorting - THANK YOU PAUL!!

2014-08-09 Thread larry

Hi Paul,
After trying MANY suggestions and my own trial and ERRORS, you finally 
provided me with a solution that actually works.

I very much appreciate that you actually tested it.
I have the feeling that many times in this list well-meaning people post 
solutions that they have not tested and therefore often do not work.

Thanks again,
Larry

- Original Message - 
From: Paul Hibbert paulhibb...@mac.com

To: How to use LiveCode use-livecode@lists.runrev.com
Sent: Saturday, August 09, 2014 9:57 AM
Subject: Re: sorting


Larry,

If I understand right, just change the direction of the second sort to put 
the beginners first, this worked for my test:


on mouseUp
  sort lines of fld sortField by word 2 of each
  sort lines of fld sortField descending by word 1 of each
end mouseUp

Paul

On 2014-08-09, at 4:56 AM, la...@significantplanet.org wrote:


Hello Alex,
OK, in my previous email I gave some hypothetical data.
In my app I actually have a field where the first word is either Advanced 
or Beginner

The 2nd word is a number ranging from 2 to 25, showing how many items.
There are some other words after those, but I'm not concerned about them.

As lines are added to the field, they are in jumbled order.
What I want is this on the sort: (All the Beginners in numeric order, 
followed by all the Advanced in numeric order)

Beginner 1
Beginner 2
Beginner 3 (etc.)
Advanced 1
Advanced 2
Advanced 3 (etc.)

Thanks,
Larry


- Original Message - From: Alex Tweedly a...@tweedly.net
To: use-livecode@lists.runrev.com
Sent: Saturday, August 09, 2014 3:51 AM
Subject: Re: sorting


Larry,
can you be more explicit about how it doesn't work ?

Actually, can you explain better what you want to do ? You said you want
to sort by the 2nd and then the 3rd word - but gave an example that
appeared to show sorting by 2nd and 1st - and not even have a 3rd word
in any line.

So how about a slightly less terse description, and an example showing
both before and after and hopefully we can get you to where you want


-- Alex.


On 09/08/2014 09:14, la...@significantplanet.org wrote:

Sorry, that doesn't work

- Original Message - From: Björnke von Gierke b...@mac.com
To: How to use LiveCode use-livecode@lists.runrev.com
Sent: Saturday, August 09, 2014 12:58 AM
Subject: Re: sorting



sort theList by word 2 of each
sort theList by word 1 of each

sort order is retained in-between commands, that's why it works.

On 09 Aug 2014, at 08:24, la...@significantplanet.org wrote:


I have a field I want to sort.
Each line has 4 words.
I want to sort by the first word (ascending) and then do a 2nd sort by 
the 3rd word without changing the order of the first word.


Example:

apple  box
apple  pie
apple  zoo
baby  blue
baby  rattle
baby  zoo
etc.

TIA
Larry
___
use-livecode mailing list
use-livecode@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@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@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@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@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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: sorting - THANK YOU PAUL!!

2014-08-09 Thread Paul Hibbert
You're more than welcome.

I often see the problems posted here as challenges, some I have no chance with 
(they are way over my head), some I learn from other's answers, some I get 
totally wrong. Occasionally I see what I think may be a solution, but I usually 
have to do a test first to be sure I understand and don't make too much of a 
fool of myself in public - sometimes get that wrong too! Most are already 
answered by the time I've worked out a reply, but I still learn.

Anyway, I'm always pleased to help if I can as are most of the others on this 
list, it's a great place to learn more about the intricacies of developing with 
LiveCode.

Paul

On 2014-08-09, at 9:33 AM, la...@significantplanet.org wrote:

 Hi Paul,
 After trying MANY suggestions and my own trial and ERRORS, you finally 
 provided me with a solution that actually works.
 I very much appreciate that you actually tested it.
 I have the feeling that many times in this list well-meaning people post 
 solutions that they have not tested and therefore often do not work.
 Thanks again,
 Larry
 
 - Original Message - From: Paul Hibbert paulhibb...@mac.com
 To: How to use LiveCode use-livecode@lists.runrev.com
 Sent: Saturday, August 09, 2014 9:57 AM
 Subject: Re: sorting
 
 
 Larry,
 
 If I understand right, just change the direction of the second sort to put 
 the beginners first, this worked for my test:
 
 on mouseUp
  sort lines of fld sortField by word 2 of each
  sort lines of fld sortField descending by word 1 of each
 end mouseUp
 
 Paul
 
 On 2014-08-09, at 4:56 AM, la...@significantplanet.org wrote:
 
 Hello Alex,
 OK, in my previous email I gave some hypothetical data.
 In my app I actually have a field where the first word is either Advanced or 
 Beginner
 The 2nd word is a number ranging from 2 to 25, showing how many items.
 There are some other words after those, but I'm not concerned about them.
 
 As lines are added to the field, they are in jumbled order.
 What I want is this on the sort: (All the Beginners in numeric order, 
 followed by all the Advanced in numeric order)
 Beginner 1
 Beginner 2
 Beginner 3 (etc.)
 Advanced 1
 Advanced 2
 Advanced 3 (etc.)
 
 Thanks,
 Larry
 
 
 - Original Message - From: Alex Tweedly a...@tweedly.net
 To: use-livecode@lists.runrev.com
 Sent: Saturday, August 09, 2014 3:51 AM
 Subject: Re: sorting
 
 
 Larry,
 can you be more explicit about how it doesn't work ?
 
 Actually, can you explain better what you want to do ? You said you want
 to sort by the 2nd and then the 3rd word - but gave an example that
 appeared to show sorting by 2nd and 1st - and not even have a 3rd word
 in any line.
 
 So how about a slightly less terse description, and an example showing
 both before and after and hopefully we can get you to where you want
 
 
 -- Alex.
 
 
 On 09/08/2014 09:14, la...@significantplanet.org wrote:
 Sorry, that doesn't work
 
 - Original Message - From: Björnke von Gierke b...@mac.com
 To: How to use LiveCode use-livecode@lists.runrev.com
 Sent: Saturday, August 09, 2014 12:58 AM
 Subject: Re: sorting
 
 
 sort theList by word 2 of each
 sort theList by word 1 of each
 
 sort order is retained in-between commands, that's why it works.
 
 On 09 Aug 2014, at 08:24, la...@significantplanet.org wrote:
 
 I have a field I want to sort.
 Each line has 4 words.
 I want to sort by the first word (ascending) and then do a 2nd sort by 
 the 3rd word without changing the order of the first word.
 
 Example:
 
 apple  box
 apple  pie
 apple  zoo
 baby  blue
 baby  rattle
 baby  zoo
 etc.
 
 TIA
 Larry
 ___
 use-livecode mailing list
 use-livecode@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@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@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@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@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
 

Re: sorting - THANK YOU PAUL!!

2014-08-09 Thread Colin Holgate
I tried Craig’s approach, but with the correct syntax, not the condensed 
example he gave. I put your example list into field 1, and had this script in a 
button:

on mouseUp
   put fld 1 into fld 2
   sort fld 2 by word 1 of each  word 2 of each
end mouseUp

I then scrambled (manually) the lines of field 1. That consistently gives back 
the list in the sorted order you showed.

Next I tried this script:

on mouseUp
   repeat with a = 1 to 100
  put item random(2) of advanced,beginner  random(100) into line a of 
fld 1
   end repeat
   put fld 1 into fld 2
   sort fld 2 by word 1 of each  word 2 of each
end mouseUp

Field 1 had a random list of advanced and beginner entries, with a level too, 
and after clicking the button field 2 showed the list as sorted.

Now, it’s an alpha sort not a numeric sort, and Paul’s approach, which was the 
same as Björnke’s, also fails in that way.

So, Craig’s suggestion was good, just not with the syntax expanded.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: sorting - THANK YOU PAUL!!

2014-08-09 Thread Paul Hibbert
Sorry, I did miss the numeric sort, it worked with a short example, but using 
Colin's test script, this also works:

on mouseUp
   sort lines of fld sortField numeric by word 2 of each
   sort lines of fld sortField descending by word 1 of each
end mouseUp

Paul

On 2014-08-09, at 9:51 AM, Colin Holgate co...@verizon.net wrote:

 I tried Craig’s approach, but with the correct syntax, not the condensed 
 example he gave. I put your example list into field 1, and had this script in 
 a button:
 
 on mouseUp
   put fld 1 into fld 2
   sort fld 2 by word 1 of each  word 2 of each
 end mouseUp
 
 I then scrambled (manually) the lines of field 1. That consistently gives 
 back the list in the sorted order you showed.
 
 Next I tried this script:
 
 on mouseUp
   repeat with a = 1 to 100
  put item random(2) of advanced,beginner  random(100) into line a of 
 fld 1
   end repeat
   put fld 1 into fld 2
   sort fld 2 by word 1 of each  word 2 of each
 end mouseUp
 
 Field 1 had a random list of advanced and beginner entries, with a level too, 
 and after clicking the button field 2 showed the list as sorted.
 
 Now, it’s an alpha sort not a numeric sort, and Paul’s approach, which was 
 the same as Björnke’s, also fails in that way.
 
 So, Craig’s suggestion was good, just not with the syntax expanded.
 ___
 use-livecode mailing list
 use-livecode@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode