In this example, we show a very easy technique of moving from one portal row to the next via buttons. On the surface this seems to be a very trivial example but it does show that you can control FileMaker's ability to navigate portal rows. This can become very helpful as you start to build larger and more complex scripts and interfaces.
In the example we have 5 buttons which are First, Previous, Next, Last and Go To Row Number. We show a portal listing the seasons of the year which are Spring, Summer, Fall, Winter and Football. The last is my favorite, I must say.
The first four buttons are not even attached to a script. You can define a button go to these portal rows directly via the button choices. Originally, this example used the go to portal row by field. During conversion to FileMaker 9, this was automatically updated to Go To Row By Calculation. Going to a portal row by the contents of a field can be scripted. This is exactly what we did. All you need to do is choose a portal row number from the value list and click the button next to it.
I also added a button called Go To Row Dialog. This will bring up a dialog box allowing you to manually enter in a portal row to go to.
I only added one tweak that is a little off of the beaten path. If the Portal Number field is empty, the script brings up a dialog box asking what portal row you want to go to . The script looks like this ...
Go To Portal Row [ Select By Number ]
Go To Portal Row [ Select, "Portal Number"]
** which is the name of the field **
The final thing we did was add another layout that uses a similar relationship but it can create new related records on the fly. You can get there by clicking the View Add Related button. From here, you can add a season to the global field and click the add new season button. This goes to the last row in the portal ( empty waiting to create new related records ), sets that field equal to the global, sets the global to empty and exits the record.
An example file can be downloaded by clicking (here)
More info about the author and FileMaker in general, contact me at email@example.com.
© 2007 - 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.