Brian Dunning's FileMaker Custom Functions

GetRecordNumber ( _field ; _value )

Given a field value, returns its current Record Number within the current Found Set

  Average rating: 3.8 (19 votes) Log in to vote

Gary Czychi   Gary Czychi
GC Consulting
czychi.com

Share on Facebook Share on Twitter

  Sample input:
GetRecordNumber ( author::name ; "Douglas Adams" )
  Sample output:
42

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Returns the first line number that contains _value, of a list of _field values of all records in the current found set
Returns NULL ("") when _value is not in the list
Returns the correct line number , no matter whether the found set is sorted or not !
=> which is IDEAL for Go To Record/Request/… script step

If it doesn't work, you probably not calling it with a field reference, but with a field value:
_field is a field reference, not a value:
If the field name is stored inside a field, use Evaluate ( ) => GetRecordNumber ( Evaluate ( g::tmpT ) ; g::tmpN )

Based on the ListValues ( Field ) recursive function from Koji Takeuchi:
Given the list of Koji Takeuchi, added number strings at the beginning of each line, followed by a tab character and the line value
At the end, searches for a tab, the _value and reads its line number, then returns the line number

Sample:
GetRecordNumber ( author::name ; "Douglas Adams" )
=> Returns the number 42 (if the record with "Douglas Adams" is the 42nd record in the current found set).

 

Comments

unix   unix, Japan
Mar 29, 2016
Undefined Null is used in this function.
I tried replacing it with "", but not get result.
 
Gary   Gary, DÜsseldorf, Germany
Mar 29, 2016
Hi,

sorry about the «Null» function, you're right. I already changed it to "", which is the exact same thing, as you have done. I use the Null function because it makes for much better reading and understanding of code afterwards.

If it still doesn't work, you are probably not calling the function with a field reference, but with a field value (whereas the _value is a value):
_field is a field reference (not a value):
If the field name, for example «author::name» is stored inside of a field, use Evaluate ( ) => GetRecordNumber ( Evaluate ( g::tmpT ) ; g::tmpN )

This will probably do it.

Thanks for your question. Now, it should be clearer.

Gary
 

Log in to post comments.

 

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

Under construction. Email me your wish list for improvements.