5 Replies Latest reply on Feb 4, 2011 8:03 AM by BenFletcher

    Specific portal row in script?

    johnkmanchester

      Title

      Specific portal row in script?

      Post

      Just upgraded to FM 11 on a MacBook. I have used the Tab Control tool to create a tab in a layout showing the table "Cd Production" on which I've placed a portal to display records from "Track Databate,"  including a field, "Composer." I've placed a button which appears in each row of the portal which goes to a third table "Composers" (on another layout); allows me to create a new record including a "name field." It copies the name, then returns to the portal where it pastes the name in the correct field.  It all works, except that it always pastes into the first portal row.  I want it to paste into the portal row from which I started, i.e. where I pressed the button. 

       

      I tried various solutions involving "Set Field," "Go to portal row," but frankly I'm lost. Any idea of how to do it?

       

        • 1. Re: Specific portal row in script?
          philmodjunk

          There are ways to do this without having your script interact with the portal at all, but that requires knowing more about your database.

           

          I don't have Filemaker 11, and what I do know about it suggests assigning an object name likely uses different steps, but other than that, this should work for you:

           

          Give your portal an object name. (This is where things may differ with filemaker 11.)

          Use a global variable to record the current portal row number. (Set Variable [$$Row; Value: Get ( PortalRowNumber ) ]

           

          Go do your stuff on the other layout.

          WHen you return use go to object to specify the correct portal, then use Go to Portal Row and specify the portal row you recorded in $$Row to get to the right row.

          Now set field can be used to modify the correct value.

          • 2. Re: Specific portal row in script?
            Steve Wright

            The only real difference is that the object name field is now on the Position Tab (and position section) of the inspector, labelled as Name:

             

            I posted a tip a while back which you may want to take a look at, it basically allows you to return to the exact position of a portal under the circumstances you are describing.

             

            Lets say you are in the middle of your portal (scroll bar in the middle that is) and you click the middle records button.

            When you return using go to portal row, normally that row will either end up as the top row or bottom.

            What I have done is return it to the exact position, so the button / record you where working on is left in the middle if that makes sense...    

             

            http://forum-en.filemaker.com/t5/Using-FileMaker-Pro/Tip-Return-to-exact-portal-position-after-leaving-and-returning/m-p/50808/highlight/true#M39836

            • 3. Re: Specific portal row in script?
              johnkmanchester

              I got you up to "global variable." Is that a field? and the formula after that (Set Variable [$$Row; Value: Get ( PortalRowNumber ) ] is that a calculation?

               

              Thanks

              • 4. Re: Specific portal row in script?
                philmodjunk

                $$Row is the global variable. Naming the variable with two $ instead of one makes it a variable whose value persists even when the script that created it terminates.  (You could also use a field with global storage specified in place of this variable.)

                 

                Set Variable [$$Row; Value: Get ( PortalRowNumber ) ]

                 

                is a script step.

                • 5. Re: Specific portal row in script?
                  BenFletcher

                  Hey guys I'm working on something similiar but I'm needing the set field to set a value in the portal row from a value list. The value list has to be used because they choose their products from it. Ideally I would love to be able to use 4 different values that they could define themselves in global fields somewhere and have them added to the value list on the fly each time they click a button. Don't think I've ever seen this done before, but could be wrong. If anyone could help out it would be appreciated..