5 Replies Latest reply on Aug 23, 2016 2:23 PM by alisings2u

    toggle sort

    john9210

      Title

      toggle sort

      Post

           FM 12 Adv. I’m trying to find a script that will toggle the sort between ascending and descending,depending on what the current sort is.

        • 1. Re: toggle sort
          philmodjunk

               IF [$$Sort = "Ascending" ]
                  #Sort in descending order
                  Sort Records [ restore ; no dialog ]
                  Set Variable [$$Sort ; value : "Descending" ]
               Else
                  #Sort records in ascending order
                  Sort Records [Restore ; no dialog ]
                  Set Variable [$$Sort ; value; "Ascending" ]
               End If

          • 2. Re: toggle sort
            raybaudi

                 or:

                 Set Varriable [ $$sort ; Value: not $$sort ]
                 If [ $$sort ]
                    Sort Records [ Restore ; No dialog ] // Ascending
                 Else
                    Sort Records [ Restore ; No dialog ] // Descending
                 End If
            • 3. Re: toggle sort
              john9210

                   Neat solution! only 6 steps. I've already adopted it for my solution.  How did you manage to comment the Sort Records script step? That's something I haven't been able to figure out.

              • 4. Re: toggle sort
                philmodjunk

                     That comment could only be done here in the forum, not in the script editor.

                • 5. Re: toggle sort
                  alisings2u

                  Hi philmodjunk,

                   

                  I have benefited from so many of your posts here but never taken the time to comment. I just want to thank you profusely for invariably coming up with clean, simple solutions and explaining them beautifully. This sort toggle is yet another case in point.

                   

                  All the best and many, many thanks!