Sort is a FileMaker Add-on that allows you to quickly implement a column sorting system on portals and list views.
In this example, 2 portals representing the same related 1,000 records can be sorted independently.
In this example, a list view of 1,000 records is being sorted.
How to
- Drag the add-on onto your layout.
- A step by step documentation is accessible in the popover with a cogwheel icon
- Still in layout mode (the popover wont show in other modes), double click the button and copy the label calculation, which will look like: Ω1MT_sort.key ( "<add-on instance ID here>" )
- Create a new field in the table you want to sort (wether it is the current table (list view, master detail…) or a related table, pay attention to created the field in the table where records should be sorted). This field must be an unstored calculation with result type as text. The calculation (expression) is what you copied at step 1.
If you are going to have several sort keys in the same table, we recommend that you add a comment to the field to make the purpose of this sort key more explicit. - Only if you are sorting the current table (list view, master detail…), double click the field ::sort_g and select the field you just created. Also move this object out of the popover, to the right side of the layout. You can simply remove the object if you're sorting a portal of related records.
- By default, the add-on comes with 5 columns when you drag it onto the layout, you can of course add or remove columns, and resize them.
- Configure each column header.
- in the label calculation, adapt the calculation to your needs: (only _columnNumber and _field are mandatory)
Ω1MT_sort.colHeader (
2 ; //_columnNumber: an arbitrary number
"" ; // _field: the field on which to sort (remove the quotes)
"" ; // _label: specify the colum name. If empty, displays the field name
"" ; //_defaultDir_AD: "Desc" or "D" for descending. Default is ascending
"<add-on instance ID here>" // _sortID ;
) in the parameter calculation, simply ensure that _columnNumber is matching the one defined in the label calc.
- in the label calculation, adapt the calculation to your needs: (only _columnNumber and _field are mandatory)
Go to browse mode and test.
Select the popover button (with the cogwheel icon) and delete it.
Performance / potential optimization.
According to our testing, this solution is very satisfying up to approximately 2000 records. Then it becomes slower than native sort on a single field.
The slowest sort order is text descending. If you are using only unaccented characters or a subset of them, there is a way to optimize this by editing the custom function Ω1MT_sort.key
Language limitation
This add-on won't sort text descending in languages that use different alphabets like Greek, Cyrillic, Thai, Arabic, Hebrew…
You could adapt the custom function Ω1MT_sort.key though to make it work.