Page Up / Page Down FileMaker Portal Rows

From Dwayne Wright PMP
Certified FileMaker Developer

WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

Please Note: If you are viewing this page in a news feeder, the images may get munged up a bit. For the best experience, please visit the journal directly by clicking (here). 

This example is a modified version of our "Go To Particular Portal Row" example. Here we have added a small modification to the Go To Row Number button and have added the ability to page up and down a portal row.


The modification to the Go To Row Number is that we removed the value list. Now the user can type into a field and enter in any valid number and go to the portal row.

The Page Up / Page down feature is a little more complex but not that bad really. In our example, we added 3 fields ... a global number and two calculation fields with a number result. The calculation field count a value of the next portal row based upon the captured portal row and the number of rows shown.

The way it works is a script sets the Current Portal Row Global field equal to the current portal row using the Status(CurrentPortalRow) function. Then we use the following calculations to decide which portal row we want to go to with the script steps of Go To Portal Row [ By field ] using the page up calculation in the page up script and the page down calculation in the page down script. The calculations are as follows...

PAGE UP CALCULATION
Case(
(Current Portal Row Global - 9) < 1, 1,
Current Portal Row Global - 9)

which simply says give us a portal row number 9 less than the current one. If that total is less than 1 ( which would be the case for rows 1 - 8 ), then go return the portal row number 1.

PAGE DOWN CALCULATION
Case(
(Current Portal Row Global + 9) > Count(self_universal::Universal_Link), Count(self_universal::Universal_Link),
Current Portal Row Global + 9)

which simply says give us a portal row number 9 more than the current one. If that total is greater than the total number of rows ( we use the aggregate count function to determine this ), then go return the number of the last number in the portal.

An example file can be downloaded by clicking (here)

FYI ... UNFAMILIAR WITH SELF RELATIONSHIPS?
A Self Relationship is a common term for a situation in which both sides of the FileMaker relationship are the same table. It is even possible that the matching key fields are the same field. This can be handy when using the Go To Related script step or when using Aggregate Functions.

Self relationships can be one to many, many to many or even the filtered varieties.

Here you can see a self relationship I use in the FileMaker database I use to contain all my blog related data. In this case, I have my blog related to itself using the same field of blog. This way I can be writing a blog for my Security blog and quickly see all the previous security related blog posts in a portal by its side.

More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 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.