Dynamic Column Sorting Indicators

Providing visual feedback about the sort state, and direction, of your list views is always a nice feature to have. Not only does it fulfill the expectations of what users are already used to within the OS, but it let’s users know they can actually sort on those columns.

In this video, I walk through the use of a Button Bar object in conjunction with some other common tricks in order to provide dynamic column sorting indicators.

This is one of those standard must-have features within your FileMaker solution!

AttachmentSize
DynamicColumnSortingIndicators.zip357.03 KB

Comments

Thanks for the great video, Matt. I have been trying out the Virtual Sort technique by Jeremy Bante on portals and found it to be a good combination with your idea to use button bars. I use the button only for the actual indicator and leave the button label separate. Then I also avoid the tab issue with styling.
I use this calc for the button bar segment:

Case (
VirtualSortFieldSortedAscending ( Terminals::z_created_ts ; "" );
SortArrowFormat(SortArrow ( False )); // up arrow
VirtualSortFieldSortedDescending ( Terminals::z_created_ts ; "" );
SortArrowFormat(SortArrow ( True )) // down arrow
)

Works great!
Thanks again.

Andreas

I have been using the boolean technique for my arrow indictors placed inside of a repeating field. But it has a huge downfall where sorting the next column does not clear the arrow in the other column. I have to use a subscript which determines which other columns have a sorted arrow (0 or 1) so that I can clear them based on their repeating number value(s). It works well enough but when my user says they want another field added with another column header, then I have to re-sequence the numbers in the subscript and renumber the repeating field! Not ideal. I think your technique is more adaptable using CF, but the extra work in setting the position of the arrow is less then ideal given different column widths.

With careful planning in your list views, you can solve the issue. You obviously know your column order and you also know which columns are wider. There's nothing that says you can't use multiple tabs within various columns. I don't think I made that part clear, but you can put two tabs for the next widest column, three tabs for the next and so on.

You can then continue to keep the style saved so that changes are applied solution wide. You just keep adding tab positions. It simply requires planning.

The other option is to use a single merge field outside of the Button Bars as an overlay. This would also use multiple tab positions, but you'd only have one layout object to use when managing all sorting indicators.

Hope that helps out!

-- Matt Petrowsky - ISO FileMaker Magazine Editor

Could you pass GetLayoutObjectAttribute as a script parameter that then subtracts the width of the arrow icon so it dynamically updates where it is from the right side based on how many pixels the text takes up? Can we count text in pixels? I guess with the point size and character count we could approximate? Have not tested this yet but trying to get around the theme restriction. This is a very elegant way of doing it and fast. I have tried a lot of methods and trying to bypass the direct sort of field using a calc that looks at a global then rebuilds the sort value in an unstored calc is great with records under 500. But this would work for large found sets, list view and portal. Great work Matt!