Jump to content
Server Maintenance This Week. ×

Multi-column dynamic sorting?


This topic is 3140 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Greets, all:

Forgive me if this topic's been covered--maybe my search criteria missed finding the answer here and on the web. What I want to do is while in List view, sequentially control the sorting of multiple columns with the ability to independently control the sort order as well.

For example, say you have the fields, City, State, and Country, and the user wants to sort by Country (descending) > State (descending) > City (ascending). The user would hold down the Shift key then select the Country field, then click it again change the sort order to descending; hold down the Shift key then click the State field label twice (once to select the column, the second to change the sort order to descending); hold down the Shift key then click the City label to select it as the third column to sort--no second click is necessary since the default sort order would be Ascending.

Something like that.

 

I'm sure this has been accomplished by somebody who either posted a solution file online or selling a plug-in. Either way, if you could point me in the right direction, I'd appreciate it. Thanks!

Link to comment
Share on other sites

dynamic sorting for multiple field can be tricky especially if you don't wish to present the standard dialog box to the end user. 

you would have to devise a matrix of all possible permutations of all the fields the user can logically sort on for all all three states {ASC;DEC;NULL} and it grows exponentially (when you add fields)

City [null] | State [null] | country [null]

City [asc] | State [null] | country [null]
City [dec] | State [null] | country [null]
City [null] | State [asc] | country [null]
City [null] | State [dec] | country [null]
City [null] | State [null] | country [asc]
City [null] | State [null] | country [dec]

City [asc] | State [asc] | country [null]
City [dec] | State [dec] | country [null]
City [asc] | State [dec] | country [null]
City [dec] | State [asc] | country [null]

City [null] | State [asc] | country [asc]
City [null] | State [dec] | country [dec]
City [null] | State [asc] | country [dec]
City [null] | State [dec] | country [asc]

City [asc] | State [null] | country [asc]
City [dec] | State [null] | country [dec]
City [asc] | State [null] | country [dec]
City [dec] | State [null] | country [asc]

 

City [asc] | State [asc] | country [asc]
City [dec] | State [dec] | country [dec]

<there are more but i ran out of steam>

An interface for the user to toggle the three states for each column (stored in a variable or global ) then a branched script to perform the stored sort orders.

- alternatives 

perhaps an SQL query to get you result of records using ORDER BY then present the records in that order. 

using a web viewer to display a jQuery grid

http://www.seedcode.com/javascript-portals-filemaker/

other complete methods involved complex calculations to flip data for the found set and depending on the volume of it can impact performance. 

 

  • Like 1
Link to comment
Share on other sites

Thanks for the answer. I thought about the matrix and its many permutations (on one layout alone I have eleven fields for "push-button" sorting. Yikes!), but maybe the simple answer is that I include instructions for users on how to manually sort data. True, it's not elegant at all but seeing that the runtime solution is both a utility and teaching tool, maybe I should code a few push-button sorts for the most popular sort requests and for the rest, code a pop-up window that instructs users how to manually sort data. Hmmm...I'll I have to think about that.

On Edit: I did find a solution that sort of does what I would like it to do (using SQL queries) but it's so far over my head I don't have a clue how it works. Therein lies the second part of the equation--whatever gets coded into the solution I have to know how it works and be able to tweak it; I don't have a budget to hire an advanced/skilled developer to make/keep making tweaks.

Edited by WF7A
Link to comment
Share on other sites

You may also want to look here. It does not provide multi-column sort but it does provide selected-column sorting from multiple columns.

That is, the use can click one column out of many columns; and have it sort by that column.

http://filemaker.463488.n4.nabble.com/Smart-Sort-List-View-v1-0-2-technique-file-td4671898.html

Link to comment
Share on other sites

Thanks, Bruce--that does look promising!

The latest version that Bruce is referring to is here.

http://fmforums.com/topic/97930-smart-sort-list-view-v103/

However, it will not sort more than 1 column at a time.

I do not believe it can be modified to fit the goals mentioned in your original post.

I have looked elsewhere for some technique that might work, as I recall this was accomplished by someone else some years ago. I have been unable to locate anything.

 

Greg

Edited by kigmaker
Link to comment
Share on other sites

  • 3 weeks later...

This topic is 3140 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.