5 Replies Latest reply on Mar 18, 2015 10:30 PM by philmodjunk

    Restoring a manual sort-order

    johnp1

      Title

      Restoring a manual sort-order

      Post

      I have a large database from which I use a compound, manual search to find a set of records.  Then I use a numeric field to manually sort the found records.

      What I'm hoping to do is restore the find (easy enough, by flagging the records) and restore the manual sort order.  I figured out a way to do this with a script, by looping through the found set, copying and pasting the ID numbers for each record, in order, in a global field.  To restore the sort order, I envision doing another manual sort based on the order of the records listed in the global field.

      I can't help but thinking there must be an easier way to do this.

        • 1. Re: Restoring a manual sort-order
          johnp1

          FYI: I HAVE looked at the FMPro help data, but perhaps I'm searching for the wrong thing.

           

          • 2. Re: Restoring a manual sort-order
            SteveMartino

            I think it may be better (not easier) to create a table for save finds, where you can name the find and put a list of all the primary keys, in the order you have them, into a regular (not global field).  This table could have 2 fields, Find::Name and Find::IDs.  Then you could have a drop down list of the Finds::Name with a script trigger that would capture the IDs from the proper saved find name (set variable), go to proper layout, Enter Find Mode, Set Field, Perform Find

            Here's a link to the VTC.  I used 12, which has some chapter specifically about Saving Multiple Find Criteria.  They used to have some of the classes for free.  It may be in V13

            http://www.vtc.com/products/FileMaker-Pro-12-Advanced-Tutorials.htm

            Actually if you go to this link, the chapters are locked, but I think they will  give you 2 chapters for free.

            • 3. Re: Restoring a manual sort-order
              philmodjunk

              If you only want to return to the previous found set (and its sorted order), you might open a new window, perform you find and sort and any other manipulations of your records. To return to the original found set, close the new window to return to the original window.

              It's also possible to do the same thing within a single window by using two layouts based on different occurrences of the same table.

              • 4. Re: Restoring a manual sort-order
                johnp1

                PhilModJunk: I need something that I can store and restore in the future, after using the same database for other finds, etc.  There could be months before I would need the restored find/sort.

                Steve Martino: I'll look into the tutorial in your link.  With the find last in your suggested scripting, won't that simply pull up the files in a random or inappropriate order?  I need the find and the sort.

                • 5. Re: Restoring a manual sort-order
                  philmodjunk

                  There are two basic approaches:

                  1) save the IDs of the found set and the sort criteria used to sort them. 

                  2) save the search and sort criteria used. 

                  With 1) you can create a record where one field stores a list of IDs. And another field the sort order or you might just save a snapshot link. 

                  2) is nearly the same but you save find criteria instead of IDs.

                  the tricky part is saving the sort criteria as there is no way to capture the criteria selected in the sort records dialog. You'd have to set up an interface where the user uses buttons or other controls that both sort the records and also keep track of the sort order.