Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages

Shopping Cart
Shopping Cart


Free Newsletter


Privacy Policy

FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.


 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

portal.FirstVisibleRow ( _portalName )

Rate this function:  

  Average rating: 4.5  (33 votes)
  Discuss this Custom Function

Arnold Kegebein, Arnold Kegebein

Get index of first visible row in a portal

Sample Input:
portal.FirstVisibleRow ( "portal.sample" )
Sample Output:

 Then copy & paste into FileMaker Advanced's Edit Custom Function window.


Calculates the index of the first visible row in a portal.
The parameter _portal is the object name of the portal.

Besides the object name for the portal, at least one object in the portal has to have an object name, too.

If the portal object name is unknown, nothing is returned.
If no object inside the portal has an object name, a question mark (?) is returned.

I was inspired by Fabrice Nordmann's function VisiblePortalRows. My cf returns only the index of the first visible row. Advantage: It does not use recursion (faster) and requires only one function parameter.

See also my function portal.rowCount to get the number of visible portal rows.

Instructions how to use this function:
(1) Create a portal.
(2) Give the portal an object name, e. g. "myPortal"
(3) Place an object into the portal, preferably a field from the portal table.
(4) Give this object an object name, e. g. "myField"
(5) Change to browse mode.
(6) Call the function (via data viewer or script or button): portal.FirstVisibleRow( "myPortal" )
(7) Scroll to a different row in the portal and call the function again.
(A) If the function returns 1, the very first portal row is visible. The return value 5 means, the portal is scrolled so far down, that the first four portal rows are not visible anymore.
(B) To verify the correct return value, add a label with the text "@@" to the portal. This will print the actual index of each portal row. The first index you can see in your portal should be the same value the function returns.

You may download a sample file with two portals at

Note: these functions are not guaranteed or supported by Please contact the individual developer with any questions or problems.

This is my Custom Function and I want to edit it


5 most recent comments | Show all 6 comments

This functions doesn't work with multiple portals in the same layout, just the first one is working.

Arnold, you have any idea why?

Caps, Lisbon
January 12, 2012 3:27am

@Caps, sorry for your problems with this function. I tried it with two portals in the same layout without any problems.

Remember, each portal requires an object name (used as the function parameter) AND an object inside each portal requires an object name as well!

You may download a sample file (with two portals in the same layout) here:

Arnold Kegebein, Hamburg, Germany
January 12, 2012 7:57am

Sorry, Arnold.

I found the problem, It was my mistake.
I was trying to create a multiportal with sort buttons, using hidden tab controls, to perform the sort.
So in other to work, the script should go first to the object (Hidden TAB), then to portal, and after doing this perform you lovely custom function.

Thanks for sharing it, and explain all at

Caps, Lisbon
January 13, 2012 6:42am

I really want to use this function but it looks as if this no longer works in FileMaker Pro 12 :( Any ideas for a workaround or hopes of a new version that works? The function works for the first 2 portal rows but after that ? is returned and some of the variables fail to evaluate within the function, I can only assume due to different way portals work in 12.

If you have another way to obtain the first visible portal row index I'd love to hear it, thanks!

Daniel Wood, New Zealand
September 18, 2012 3:32am

@Daniel Wood,
Thank you for pointing out the problem with this function in FM12. Somehow FileMaker changed the behavior of the function GetLayoutObjectAttribut. I am not sure if this is a bug or an intended behavior.

Nevertheless I created a version of this cf that will work with FM12. I posted it here BrianDunning under the name PortalFirstVisibleRow. It should be accessible soon.

Arnold Kegebein, Hamburg, Germany
September 19, 2012 2:19am

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 6 + 1 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. SortList ( theList )
  (Sat, Jun 23, 8:45am)
2. HexUUIDToNum_cf (_uuid)
  (Sat, Jun 16, 1:55pm)
3. httpResponseCode ( responseHeaders )
  (Tue, Jun 12, 10:40pm)
4. FindDuplicateCharacters ( string )
  (Fri, Jun 08, 5:01pm)
5. FieldRepetitionLast ( field ; maxRepetition )
  (Wed, Jun 06, 6:05pm)
6. CountModifiedRecords ( NameTimestampField ; StartTimestamp ; EndTimestamp )
  (Mon, May 28, 8:23am)
7. JSONArrayLength ( JSONArrayStr )
  (Fri, May 25, 7:46am)
8. interpolation (y1; y2; y3; x1; x2; x3; x1y1; x2y1; x1y2; x2y2; rnd)
  (Sat, May 19, 3:55am)

RSS Feed of Custom Functions