Sorting List View Columns

by Matt Petrowsky
18 minutes

Article options

Sorting list views is simply one of those features which all users expect. If it isn't there, they notice. If it is, then everything is fine in the world of your database.
Since FileMaker knows nothing about your solution, you have to specify which fields are sorted and in which direction. The problem with doing this across a number of scripts is having to edit all those scripts when you want to make minor changes. On top of that, you may have them organized in a variety of locations within ScriptMaker.
It certainly would be nice if sorting could be accomplished programatically - but, it can't right now. So the next best thing is creating a few universal scripts which allow you to control all of your sorting from within one script.
In this video, you'll learn how to maximize sorting your list views and making your solution that much easier to manage!

Details: Released - 5/24/2007 / Size - 18.54 MB / Length - 18 min

Comments

can you point me in the right direction for how to add a graphic element (like an up or down arrow) - so that visually i can see which column is sorted, and in which direction. (the arrow only appears on the sorted column). That would be a great final touch to your current great technique!

Sorry about this omission. I was in such a hurry to get this great technique out. Here is a link to the easiest way to add arrows to indicate direction.

With some smart use of tab stops you can using one single calculated field to indicate which column is sorted in which direction.

http://www.filemakermagazine.com/videos/unicode-creativity.html

-- Matt Petrowsky - ISO FileMaker Magazine Editor

Thanks Matt for your hint, I normally used graphics for that.

I used your example and added a scriptstep when sorting:


Set Variable [$$_toggle;Value:"1a"]

after sorting the first field ascending, "1d" for descending, "2a" for the second ascending and so on.

Changing the toggle arrow example to an calculation with repetion and the following code:


Let(
[
_font = "Arial";
_left_arrow = TextFont("â–²"; _font);
_down_arrow = TextFont("â–¼"; _font)
];
Case(
$$_toggle = Get(CalculationRepetitionNumber)&"d"; _down_arrow;
$$_toggle = Get(CalculationRepetitionNumber) & "a";_left_arrow; ""
))

lets you easily position the needed repetion field in the layout.

This is great information. I tend to not use list layouts but rather portals to show lists so that users can see related content. Is there an easy way to alter the technique file scripts to sort a portal rather than the found set?

I tried to plug in a goto object script step and also a goto portal row script step - neither worked.

BTW - Love the videos, I've learned a lot with them

There is a technique for portals. The trick uses tab panels to accomplish this. It's a bit messy, but very fast - as opposed to a complex scripted solution.

What you do is use a unique portal for each sort direction you want to support. You put these onto a tab panel and use a sort indicator for the switching method. The sort indicator is the graphic for each tab in the panel. Switching to a new tab pane reveals the same portal in a different sorted direction.

Like I said, it's messy, but it's fast.

-- Matt Petrowsky - ISO FileMaker Magazine Editor

Hi. I tried this with Filemaker 8.0 Advanced, and did´t recognize any Errors. Can anyone tell me if im wrong?
FM 8.5 is not necessary in my opinion.