3 Replies Latest reply on Aug 22, 2013 9:40 AM by philmodjunk

    re-ordering portal records



      re-ordering portal records


           Is there a simple method the re-order records within a portal to the users choice? I currently use a flag as a field attached to each record that can be re-numbered then automatically sorted - ideally I want to be able to slide the records up/down or have flags re-number when they are moved up/down using keys. Hope that makes sense?

        • 1. Re: re-ordering portal records

               So your portal looks something like this?

               1 Fred
               2  Ally
               3  Smith
               4  Jones

               and you edit the numbers in the first column to change the order of the records in the portal?

               Do the numbers need to be visible?

               A fairly simple script that uses the getNthRecord function to access the value of the order field of the preceding or succeeding record can be used to "bump" a record up or down one row in the portal. Other controls could be set up where you click to select an item in one portal row and then click to select the row where you want to insert the selected record before it.

               And I even have a demo file reference somewhere, don't know if the link is still valid, where you can reposition records in a portal with drag and drop, though the method used can be quite a challenge to understand and thus apply to your own solution.

          • 2. Re: re-ordering portal records

                 Hi, that's exactly it!

                 I have the number visilbe for ordering but set to 'not print' - so, preferably not visible. I'd be very interested in your demo if you can forward it?

                 Thank you

            • 3. Re: re-ordering portal records

                   It's not my demo, it's from another forum and I don't know if it still works. If it does, it will download an .fp7 format file that you will need to open from the FIle menu in FileMaker 12 to get a file in that format. Here's a link to the thread where this method was discussed and which includes the download link from the other forum: sorting portal rows with drag and drop functionality

                   For the simpler methods that I described, scripts can use GetNthRecord to access the sort value of other fields and can use Set Field to update teh value of a sort field. The Mid point formual is a simple way to get a value between to sort values from the sort field in order to insert another record between two records. The fact that this generates ever more complex decimal values in your sort fields is not a problem if you don't put the field in the portal and set field does not require that the field be present on the layout in order to change the value in it.