From Dwayne Wright PMP, PMI-ACP, CSM
Certified FileMaker Developer
The "Go to Portal Row" script step takes the user to a portal row on the current layout. This script step includes the options of going to the first, last, next and previous portal rows. Later versions of FileMaker also include the ability to go to portal row by a calculated value.
First will go to the first row and last will go to the last portal row. Next will go to the next portal row from the existing one. Previous will go to the previous portal row from the currently selected row.
Note: If the relationship the portal uses is setup to create new records automatically, the go to portal row last will take you to an empty portal row used for creating new related records on the fly.
The go to portal row next and go to portal row previous also have the option to exit after the last. This is used so you can easily exit out of a loop operation that is going from portal row to portal row as it executes a set of script steps.
The ability to go to a portal row via a calculated value opens up plenty of options for the creative programmer that stumbles upon unique needs.
HOW IT IS USED
A number of times it is used to work with individually sold line items in an invoice record. By clicking a button attached to a script, you could always go to a blank portal row. It's also nice way to create new records in a related database. It is also used in a number of situations where data needs to be compiled or broken into little pieces.
If you want to use the "Go To Portal Row-Last" to create a new record, be sure you have a vertical scroll bar in your portal. If you don't, you might overwrite information already in the last row!
It’s not surprising that a feature as embraced by the FileMaker faithful as portals, would have it’s own script step. The script step, Go To Portal Row, is found in the Navigation family of script steps. As you might of guessed, this allows ScriptMaker to go to a particular portal row in a portal that is on the current layout. The script step does have the options of...
Selecting the entire portal row or not - which is great when want to work with the portal row as a whole instead of one of the fields in the portal row.
Specify Portal Row ( first, last, next, previous, by number, by field value ) - which is great because you can control what row you want to go to. Many times, you will see the Go To Portal Row script step within a script loop.
The next and previous options include the check box setting of exit after last. This is necessary when you are in a script loop because you don’t want to loop forever. It likely goes without saying but you can do some very inventive things with go to portal row by number or the current contents of a field.
If the portal is not on the correct layout when the script is executed, the script will malfunction. If no portal is on the current layout, no portal is selected. If there is a portal on that layout, the script step will go to it.
We should cover the Go To Portal Row [ Next ] in more detail. This is because ( based on how you set your portal up ) there are a few nuances that you may need to consider.
If the portal has the vertical scroll bar, then the Go To Portal Row [ Next ] works as advertised. If the relationship is setup to allow the creation of related records, there will be a blank portal row at the bottom of the portal. It should be noted that this represents a related record that COULD be, not an existing related record. So the Go To Portal Row [ Next ] will go to it but there is no related record. This may goobered you up if your script does not take this into account.
If the portal does not have a vertical scroll bar AND the create related record option is OFF, the Go To Portal Row [ Next ] works as long as there is a valid related record.
Things can get a little off if you have more related records than you have portal rows ( remember, in this case the vertical scroll bar is off ). Then the Go To Portal Row [ Next ] will only go to the last portal row shown.
Personally, I almost always use the vertical scroll bar in my portals.
More info about the author and FileMaker in general, contact me at firstname.lastname@example.org.
© 2008 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.