Different Sort of Sort
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Different Sort of Sort
I have lines in a field:
1 BHO
4 RLO
6 BHE
etc.
Is there a way to sort them on item 2?
1 BHO
4 RLO
6 BHE
etc.
Is there a way to sort them on item 2?
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.
Programming powered by coffee.
Re: Different Sort of Sort
Hi.
Yes.
But I do not see the items. If you had:
cat,dog
deer,ticks
night,day
And did this:
Would give you:
night,day
cat,dog
deer,ticks
Read up on the sort command in the dictionary.
Craig Newman
Yes.
But I do not see the items. If you had:
cat,dog
deer,ticks
night,day
And did this:
Code: Select all
sort thatList by item 2 of each
night,day
cat,dog
deer,ticks
Read up on the sort command in the dictionary.
Craig Newman
Re: Different Sort of Sort
If it HAS to be ITEMS:
...
set itemdel to SPACE
sort lines of fld X by item 2 of each
...
If NOT:
...
sort lines of fld X by WORD 2 of each
...

...
set itemdel to SPACE
sort lines of fld X by item 2 of each
...
If NOT:
...
sort lines of fld X by WORD 2 of each
...

Re: Different Sort of Sort
Klaus
I was thinking of a function from my FoxPro days:
char to ASCII
ASCII to char.
The only place I see ASCII mentioned in the
Dictionary is in reference to sorting (I think).
I was thinking of a function from my FoxPro days:
char to ASCII
ASCII to char.
The only place I see ASCII mentioned in the
Dictionary is in reference to sorting (I think).
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.
Programming powered by coffee.
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Different Sort of Sort
Well I made a stack as per your recipe and put THIS in my button [I called my listField "ff"]:
on mouseUp
sort fld "ff" by char 2 of each
end mouseUp
and it sorted the items by the second letter.
The only potential snag is that it put those 3 items
in lines 4,5 and 6 of the field.
Of course IFF you are using Unicode characters things will get a bit more awkward.
on mouseUp
sort fld "ff" by char 2 of each
end mouseUp
and it sorted the items by the second letter.
The only potential snag is that it put those 3 items
in lines 4,5 and 6 of the field.
Of course IFF you are using Unicode characters things will get a bit more awkward.
Re: Different Sort of Sort
Code: Select all
sort field 1 by word 2 of each
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w