5 Replies Latest reply on Sep 26, 2012 9:44 AM by philmodjunk

    Display "Sorted by"

    Epa

      Title

      Display "Sorted by"

      Post

           I have a title bar, where each title is a button that sorts a list by that title.  Is there anyway to create a field on my layout that displays which button was pressed last?  For example, if you click on Name in the title bar, I want to have a merge field that reads: "Sorted by: Name"

           Thanks 

        • 1. Re: Display "Sorted by"
          philmodjunk

               If you set up your buttons to perform a script, the same script that sorts your records can also set a value in a field or variable to produce that effect.

          • 2. Re: Display "Sorted by"
            Epa

                 Thanks, I was hoping to find a quickewr way, but I guess I will have to create a script for each of these buttons.

            • 3. Re: Display "Sorted by"
              philmodjunk

                   It's a pretty simple script. You only need two steps plus comments.

              • 4. Re: Display "Sorted by"
                Epa

                     What function would you use to set the "Sorted by" field?  

                • 5. Re: Display "Sorted by"
                  philmodjunk

                       It depends on your version of FileMaker and your personal preferences:

                       Sort Records [no dialog;restore]
                       Set Field [YourTable::gSortOrderLabel ; "Sorted by: Name"]   ----> usually best to make gSortOrderLabel a field with global storage.

                       Sort Records [no dialog;restore]
                       Set Variable [$$SortOrderLabel ; value: "Sorted by: Name" ]

                       The second option requires Filemaker 11 or newer. To display the contents of a variable on your layout, you add it as a "merge variable" which will look like this:

                       <<$$SortOrderLabel>>

                       and can be added to your layout with the text tool or from the Insert Menu.

                       If you have trouble with Set Field:

                       When Setting up Set Field, there are two Specify buttons that must be clicked. To get Set Field [Table::Field ; Expression], add set field to your script and click the first button (specify target field). Select Table::Field from the list of fields. Do not click the specify button next to the repetition box. Click OK to close this dialog box. Now click the lower specify button (calculated result) and create the expression to the right of the semicolon (;). Do not try to type in the semicolon.