2 Replies Latest reply on Mar 26, 2015 11:35 PM by Mitch

    Portal Loop for First Record

    Mitch

      Title

      Portal Loop for First Record

      Post

      Anyone know how to write a loop that goes to the first portal record in each main record and executes a command.

      I need to make changes to the first portal record of each of my main records.  

       

      Mitch

      Filemaker 12

       

       

        • 1. Re: Portal Loop for First Record
          philmodjunk

          If the portal is NOT sorted (Sorting as part of the relationship is OK) and NOT filtered, any reference to fields of the related table from the context of your layout's table will automatically reference that first portal row.

          Show All Records
          Go to record/request/page [first]
          Loop
              Set Field [PortalTable::Field ; //put an expression or value here to set to a field in the first row of your portal ]
              #Repeat the above step for different fields of your portal record as much as is needed
              Go to Record/Request/Page [Next ; exit after last ]
          End Loop

          If this is a sorted and/or filtered portal, the above method still works with with the addition of a few added steps:

          In layout mode, select the portal and use the Inspector's Name box to give the portal an object name. I'll pretend that you named it "portal" for this example. then add two steps just after loop in the above example:

          Go to Object ["portal"]
          Go to Portal Row [First]

          The first step puts the focus on the correct portal (you might have more than one on your layout now or at some time in the future.)
          The second step puts the focus on the first portal row.
           

          • 2. Re: Portal Loop for First Record
            Mitch

            Works perfectly.  Thanks.