Creative Wisdom ยท FileMaker Pro tipsArchive

Sorting columns in a table

Chong Ho (Alex) Yu, Ph.D., MCSE, CNE, CCNA (2001)

Question

I want to present the search result as the following: If the user clicks on a button (or a link) in the header, the data will be sorted according to the value of that particular variable. How could I accomplish this? (The following table is dummy. Please do not click the sorting link).

Item ID
descending
ascending
Sample size
descending
ascending
Mean
descending
ascending
Point
Biserial
descending
ascending
Discri-
mination
descending
ascending
113.13.01-.08
213.11.13.1
313.18-.07-.16
413.02-.21-.09
513.96.23.18
612.69.13.16
712.76.12.13
812.13.43.28
912.81.21.23
1012.5-.08-.29

Answer

You can create different links for different sorting functions by specifying the database, the layout, the action, the sorting order,and so on. The following is an example for sorting the Item ID field in a descending order. It is important to note that the whole thing must be in one line. I put them in different lines just for clarity.

	http://URL/folder_name/
	FMPro?-db=databasename
	&-format=SearchResults.htm
	&-lay=layout%20%231
	&-max=all
	&-SortField=itemid
	&-SortOrder=descending
	&-op=eq
	&-find   

The meanings of the preceding code is explained in the following:

SyntaxDescription
http://URL/folder_name/Specify the server's URL and the folder in which you store the SearchResults.html
FMPro?-db=databasenameSpecify the name of the database
&-format=SearchResults.htmSpecify the page to display after sorting. Usually it should be the same page in which the table is displayed.
&-lay=layout%20%231Specify the layout name from which the database pulls data.
&-max=allSpecify how many records you want to display at once.
&-SortField=itemidSpecify that the field to be sorted is ItemID
&-op=eqSpecify the comparison operator as "equal"
&-findSpecify the action as "find"

You can repeat the same procedure to create sorting links for other fields.