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_Row_Number ( ID ; Field ; Counter )

Rate this function:  

  Average rating: 4.1  (32 votes)
  Discuss this Custom Function

Simon Ward, Linear Blue Ltd.

Find a record number from its position in a portal row.

Sample Input:
Portal_Row_Number ( 2 ; Related::_kp_Field ; 1 )
Sample Output:

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


This calculation will display which portal row a record is based on a Pirmary table and Line items table. There must be a relationsip between the Line Items table and its self based on the Primary Table Key. i.e each line item will display the same portal that would be seen from the Primary record. In the Calculation the Related::_kp_Field is over this self relationship.

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


Hi Simon

Thank you for posting this CF. I couldn't get it to work in FM14 but your concept was so elegant that I've slightly modified the code and it seems to work for me.

The changes I've made are; including totalRows in the parameter set (so it is determined once rather than for each iteration) and including the 'getField' function in the getNthRecord element.

So, my version of your CF is now:

Case (

Counter > totalRows ; "0" ;

ID = GetNthRecord ( GetField ( Field ) ; Counter ) ; Counter ;

Portal_Row_Number ( ID ; Field ; totalRows ; Counter + 1 )


I couldn't understand the part of the description regarding the requirement for the TO relationship definition, but the modified code seems (so far!) to work on any portal without any further TO being required. All I send the CF is; 'getfield ( the PrimaryKey field )' for the current portal row, 'getfieldname ( PrimaryKey field)', the number of rows of the current portal relationship, & '1'.

John Buckingham, Inverness, UK
November 29, 2016 1:13am

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 1 + 6 =
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. JSONArrayLength ( JSONArrayStr )
  (Fri, May 25, 7:46am)
2. interpolation (y1; y2; y3; x1; x2; x3; x1y1; x2y1; x1y2; x2y2; rnd)
  (Sat, May 19, 3:55am)
3. @JSONFormatElements ( json )
  (Tue, May 15, 3:31am)
4. WindowNamesAll ( dbNames ; excludeCurrentWindow )
  (Sat, May 12, 11:34am)
5. RandomChoiceFromList ( values ; required )
  (Wed, May 02, 6:35am)
6. @JSONFormatElements ( json )
  (Fri, Apr 27, 7:31am)
7. MBS-OCR ( language ; Image )
  (Mon, Apr 23, 1:48pm)
8. MBS_Image_Rotate ( Picture ; rotation )
  (Mon, Apr 23, 1:27pm)

RSS Feed of Custom Functions