12 Replies Latest reply on Mar 15, 2017 6:01 AM by jormond

    Dynamic Portal Sorting


      I'm upgrading a system from FileMaker 9 to 14.


      One of the issues I'm having is creating a dynamic portal sort function - click on a column header, sort the data. The old system did a brute force method - hidden tabs with copies of the sorted portal on each tab. I want to simplify the system to a single portal.


      Previous dynamic systems that I've done were always a simple parent to child system and it was pretty easy to set up.


      This version uses a join table, so the data that I need to sort on is now an extra jump away and the old method doesn't work.


      A bit of Googling found a couple of methods - VirtualSort up on modularfilemaker.com was my first stop but I haven't been able get that one integrated properly.


      Does anyone have any methods for this that are easy to integrate? I've got time constraints on this and need to get something up and running quickly.



        • 1. Re: Dynamic Portal Sorting

          I used to use this method where you have two global and two unstored calc fields – say, cSortAsc and cSortDesc – with


          cSortAsc =

          Case (

            gSortDirection = "asc" ;

            Case (

              gSortField = suchAndSuch ; thatField ;

              gSortField = soAndSo ; otherField etc

             ) ;




          and cSortDesc testing on "desc"; dates and numbers are brought into a padded text format to sort consistently


          then using these fields in the portal sort order, sorting asc and desc, respectively. Attach a script to the column headers and pass either the new field name or (if same as active) switch the sort order. 


          Has the drawback that you need at least two fields per sorted portal in the table (rather than four, since nowadays you could substitute the globals with $$vars).


          No idea how viable this is today (and augmenting it with modern tools; this is from the 7ish era), and of course I cannot judge how easy you find this to implement …

          • 2. Re: Dynamic Portal Sorting

            Kevin Frank pointed me in the right direction; adding a couple of fields to each child table that gets sorted and using them to sort the portal on. Works fine for portals that have no more than a couple hundred records. After that it bogs down.

            • 3. Re: Dynamic Portal Sorting

              DavidZakary wrote:


              Kevin Frank pointed me in the right direction


              Hi David,


              why ask questions here if you ignore the responses?



              • 4. Re: Dynamic Portal Sorting

                Who said I ignored the responses? I stated that Kevin Frank was able to help me with my problem.


                I'm not going to get into a war of words, but I found your response inappropriate. End of discussion.

                • 5. Re: Dynamic Portal Sorting

                  If the solution that erolst posted was "inappropriate", what solution did you end up using?  I'm trying to figure out the best way to do this too....

                  • 6. Re: Dynamic Portal Sorting

                    I don't know what Kevin told David, but there are several blogs that might help. Here's part 3 (with links to more articles):


                    Portal Sorting, part 3 | FileMakerHacks



                    • 7. Re: Dynamic Portal Sorting

                      I was looking for a solution to a similar problem, and stumbled across this posting by Tom Fitch:  Fitch: FileMaker Portal Sorting That Doesn’t Suck


                      I found it very easy to implement - but it does require a new field, perhaps two...I ended up using 3. 


                      I made one field for the "ListOfIDs..." summary; a global field to hold that list; and the calculation field that determines the sort order for each record (based on the global field's list of IDs).  I haven't tested it with a large set of records, but seems to work really well so far.  You could use a second "ListOf..." summary field to compile a list of the actual sort orders so you could pass it to the server for context recreation, or just compile both the IDs and the sort order via ESQL to pass both.


                      --  Justin

                      • 8. Re: Dynamic Portal Sorting

                        Just to keep this post up to date, since it's first in Google for the subject. Here is Kevin's latest post on the matter of dynamic portal sorting & filtering, courtesy of Joel Englander genius, hits the high performance challenge and suitably beasts it!

                        • 9. Re: Dynamic Portal Sorting

                          I'm partial to the technique of using multiple portals hidden under different slide control areas. Clicking on a column header to sort simply uses Go to Object to switch to different panes. Very easy to setup. The slide control can easily be hidden so it doesn't appear to be there. The downside is when needing to make a change to the portal requires the same change across all iterations of the portal.

                          1 of 1 people found this helpful
                          • 10. Re: Dynamic Portal Sorting

                            I'm partial to not allowing sorting!! haha


                            I liked the multiple portals approach, until that one fateful day I found myself trying to update 45 portals. Now, I will fully admit, that the requirements for the sorting in that use-case should have moved me to redesign the layout/workflow. But it was a long time ago, and I didn't know any better.


                            There are also a lot of cases where I need to allow sorting on multiple columns. In most cases, I prefer to design around a list view instead of a portal. It can't always happen that way, but I'm creative!!

                            • 11. Re: Dynamic Portal Sorting

                              Well, yes, of course. Excessive # of rows and one should use List View for the related records. A portal is great - using Sorting and/or Filtering, but within reason.



                              • 12. Re: Dynamic Portal Sorting

                                ::mischievous smirk:: "within reason" That's subjective. When have you known me to be "reasonable". haha