Hi all,
I'm sure this is fairly simple but I can't get my head round it. I have a field which contains...
1 1
4 5
1 3
2 1
4 2
4 4
2 3
1 2
4 1
2 2
4 3
2 4
3 1
3 2
It like to sort it first by item 1 (Itemdelimiter is tab) and then item 2 so the field reads...
1 1
1 2
1 3
2 1
2 2
2 3
2 4
3 1
3 2
4 1
4 2
4 3
4 4
4 5
Any help would be gratefully appreciated.
Thanks
Louis
Sort by item 1 and then item 2
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Livecode Staff Member
- Posts: 861
- Joined: Fri Feb 06, 2015 4:03 pm
Re: Sort by item 1 and then item 2
Hi Louis,
try this:
Best,
Panos
--
try this:
Code: Select all
on mouseUp
set the itemdel to tab
sort lines of fld 1 by item 2 of each
sort lines of fld 1 by item 1 of each
end mouseUp
Panos
--
-
- Posts: 4
- Joined: Mon Oct 03, 2016 8:11 pm
Re: Sort by item 1 and then item 2
Many thanks! Was sorting by item 1 first THEN item 2.
This works great!
This works great!
Re: Sort by item 1 and then item 2
You can do this in one line:
Sort this by sortKey1 & sortKey2 & ...
Craig Newman
Sort this by sortKey1 & sortKey2 & ...
Craig Newman