Sorting Grid on 2 columns at once or quickier ?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
teriibi
Posts: 254
Joined: Mon Nov 13, 2017 3:49 pm
Location: Bolivia

Sorting Grid on 2 columns at once or quickier ?

Post by teriibi » Thu Jan 18, 2018 8:44 pm

Hi,

Im using this syntax who does the Job so as to sort my Grid
1) By continent and
2) Sort country A/Z within each continent.

Is there any better (1 line?) syntax to achieve the same ?
or
some code that would be faster in case of some very very long list..
as if I added all States Names (worldwide)
:?:
(number of countries wont change much) :)

Code: Select all

on mouseup
   set the dgProps["sort by column"] of group "DGLands" to "CName"
   set the dgProps["sort by column"] of group "DGLands" to "Continent"
end mouseup
Thanks ! :arrow:
:roll:

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: Sorting Grid on 2 columns at once or quickier ?

Post by quailcreek » Thu Jan 18, 2018 9:21 pm

This is another way, which I think is faster. I do not believe you can do a simultaneous double sort.

Code: Select all

dispatch "SortDataByKey" to grp "DGLands" with "CName", "text", "ascending", "true"
send "RefreshList" to grp "DGLands"
Tom
MacBook Pro OS Mojave 10.14

teriibi
Posts: 254
Joined: Mon Nov 13, 2017 3:49 pm
Location: Bolivia

Re: Sorting Grid on 2 columns at once or quickier ?

Post by teriibi » Thu Jan 18, 2018 9:32 pm

Cool, thanks !
Actualy much better since I can specify the order ! :idea:

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”