1 Reply Latest reply on Jun 21, 2013 5:15 AM by ninja

    Sort Toggle  "Demystify" me Please



      Sort Toggle  "Demystify" me Please


           Hi Guru's

           I have a layout that is a list view that is used to print off a list of patients with adverse events. I would like to set the column headings (which are test fields on a header part) as a toggle buttopn to sort ascending and then decenscending on the second touch. 

           I hit the web too look around and all solutions if found seem very complicated and hard to understand (i am very new to filemaker).

           Could somone please explain slowly with big words how this is possible in list view.





        • 1. Re: Sort Toggle  "Demystify" me Please

               There are a number of ways to do this.  The more complex ones tend to be more efficient.

               A less efficient, but fairly simple method is to create a "toggle" field for each header (don't put it on the layout).

               Make the column header a button which launches a script:

               If (Table::togglefiled = "ascending")

                    Sort Records  {specify the sort here for descending}

                    SetField (Table::togglefield ; "descending")

                    Exit Script


               Sort Records {specify the sort here for ascending}

               SetField (Table::togglefield ; "ascending)


               You can also fancy it up by conditionally formatting the header or an associated graphic to visually display the sort order based on the value of the toggle field.


               Again, this is a simpler to understand, but less efficient way to toggle the order.