PortalFirstVisibleRow ( _portal )
Get index of first visible row in a portal (FM12+ ONLY)
Average rating: 4.4 (31 votes) Log in to vote
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
THIS CF IS FOR FM12 ONLY! For a FM11 version of this function check out http://www.briandunning.com/cf/1243.
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.
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): PortalFirstVisibleRow( "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 or less than 50% of the row height visible.
(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.
Daniel Wood, Digital Fusion Ltd
Sep 19, 2012
|Awesome! Thank you so much for taking the time to write this function for FM12 Arnold, I really appreciate it!|
Daniel Wood, Digital Fusion Ltd
Oct 4, 2012
In testing this function I notice that it works great in FileMaker Pro 12, but is not working in FileMaker Go 12. In GO 12, the max visible row it returns is 2, even if you are scrolled well down the portal. However the same solution in Pro shows the correct first visible row.
I'm not sure how this could be fixed, and perhaps it is a bug with Go, do you know of any ideas?
Jan 28, 2013
|Not working here. I think there is a problem with the syntax. Using FM12|
May 8, 2013
|I cant get it to work either. I have named the portal and a field in the portal but just get ? as the result. Are you able to post an exmple file like you did with the fm11 version? (that works)|
Rob, Cleveland, OH
Sep 25, 2015
|This function is recursion bombing. Arnold, I was very hopeful when I stumbled across this but it's not working as noted by the previous 2 posts. Now on FM14. Did FM change behavior again? I could not get the pre FM 12 version to work either.|
moxa4, Berne, Switzerland
Sep 27, 2016
|That was just what I needed. Great job! Thank you!|
Jun 11, 2018
I am trying to use this on FM 17.
When I load the fm dbase it works beautifully. Shows the the first portal row number in the data viewer as it should. When I scroll down and hit refresh sure enough it has the right number.
If I go into layout mode and then return to browse mode all it displays it a '?'.
The only way to get it to reset and work again is to completely close filemaker and reload it and the dbase. Once again all is well until I go into layout mode....
Nice custom function but has a flaw that is a bit irritating to deal with.
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.