2 Replies Latest reply on Feb 23, 2017 4:33 PM by BMyers

    Reorder Portal Lines ( not sorting)

    user28271

      I have two tables.

       

      PO Header

      PO Lines

       

      User enter items for PO in line in a portal in the PO Header.  Nice and basic.

       

      But sometimes a user want to reorder the lines. 

       

      What I do is I assign each line a number (in tens).  Line one is 10, line two 20, and so on.  The portal is set to sort by this field.

       

      If they want to reorder I give them access to that field and they can adjust this number. Such as change line 30 to line 15.   A through back to my old Computer Days (1980s).

       

      I am thinking of writing a routine with up and down arrows on each line.

       

      Before I embark I was curious if anyone has done this before and has comments, advise,  or even a canned solution I can buy.

        • 1. Re: Reorder Portal Lines ( not sorting)
          philmodjunk

          GetNthRecord is a function that can be used to access a field from another record in the same portal. I've used a simple calculation to move a record up one row in the portal:

           

          Set Field [ YourPortal::SortField ;

                Let ( [ R = Get ( RecordNumber ) ; // position of current portal row

                          R1 = If ( R > 2 ; GetNthRecord ( YourPortal::SortField ; R - 2 ) ;

                          R2 = If ( R > 1 ; GetNthRecord ( YourPortal::SortField ; R - 1 ) ] ;

           

                          (R1 + R2 ) / 2

                      ) // Let

                  ]

          Commit Records

           

          After re-ordering you can either use a looping script to renumber them to make the numbers pretty or you can use Go To Related Records to pull up a found set and renumber them with the Replace Field Contents script step.

          • 2. Re: Reorder Portal Lines ( not sorting)
            BMyers

            Yes, someone has a demo on this.  Check out Delfs Engineering "Better DragSort Module"

             

            Here is a video: Better Portal Drag Sorting - ISO FileMaker Magazine

            1 of 1 people found this helpful