4 Replies Latest reply on Sep 10, 2012 7:21 AM by philmodjunk

    Looping empty portal row ...



      Looping empty portal row ...


           I am using FM 12 adv.

           My app is using a double loop.  The outer loop loops through member records.  The inner loop, loops through each member's dues records. 

           The problem:  The command "Go To Portal Row [Select; Next; Exit after last] does not recognize that the 'next' row is the empty, blank row of the portal.  It then runs the associated scripts which input values and consequently generate a new, blank record which it goes to ..... forever.  

           How do I structure my loop to recognize that the empty row is the empty row?




        • 1. Re: Looping empty portal row ...

               You haven't posted the sub-scripts, so I can't know how they finish, but presumably when it comes back after the 'Reset evaluate...' scripts you would be better to drive it to the right layout, and the right object, and also the same portal row as it was on before it left.

          • 2. Re: Looping empty portal row ...

                 Don't use go to portal row.

                 Option 1: Use Go To Related Records to bring up a found set of the records from the portal on a layout based on the portal's table. Loop through the records there using Go To Record [next ; exit after last ]. If this is a filtered portal, you can include a constrain found set to limit the found set to those that pass the filter.

                 Option 2: Use Exit Loop If [ Get ( CurrentPortalRowNumber ) = Count ( DuesTableOccurrence::NeverEmptyField ) ] instead of the Exit after last clause.

                 Option 3: Modify the relationship and possibly your layout design to remove the "Allow creation of records..." option. Then you can use go to portal row.

            • 3. Re: Looping empty portal row ...

                   Hi Phil,  Thanks for the options.

                   I started to use Option 1 but kept getting the message that effectively said "It could not change a field because the record was in use in another window".  This was true and after watching Todd Geist's Commit Record video I thought I had a handle on this problem.  I guess I need to watch it again. 

              • 4. Re: Looping empty portal row ...

                     Sounds like you are using the new window option with Go to related records. Instead, freeze the window and keep it all in one window.