AnsweredAssumed Answered

GetNthRecord Unreliable in custom function

Question asked by BruceR on Feb 6, 2011
Latest reply on Apr 24, 2012 by Dillik

Summary

GetNthRecord Unreliable in custom function

Product

FileMaker Pro

Version

11

Operating system version

OSX 10.6.6

Description of the issue

Custom function using GetNthRecord produces unreliable results. Where it should return the actual value of the Nth record, it instead returns the value from the current record.

See http://www.briandunning.com/cf/1275 for basic concept of custom function and its purpose.

Note that I rewrote the function as shown below and it is my version which we are discussing. Note also that I changed the function name slightly: ListFound_Conditional

Case( start <= Get(FoundCount)  ;
Let([
thisvalue = Case(  GetNthRecord ( filterField; start )  = filterItem ;  "" & GetNthRecord ( field  ; start ) );
next = ListFound_Conditional ( Field ; start + 1; filterField; filterItem ) ];

List(  thisValue; next )
)
)

Steps to reproduce the problem

Use function defined as shown below. Note absence of empty string before second getNth.

Case( start <= Get(FoundCount)  ;
Let([
thisvalue = Case(  GetNthRecord ( filterField; start )  = filterItem ;  GetNthRecord ( field  ; start ) );
next = ListFound_Conditional ( Field ; start + 1; filterField; filterItem ) ];

List(  thisValue; next )
)
)

Expected result

Given a record set and params passed to function that should return:

1
2
3
4

Actual result

If you are on a record where the value of the specified field of the current record is 57, the result will be:

57
57
57
57

Exact text of any error message(s) that appear

No error message

Configuration information

FileMaker 11.0v2, OSX 10.6.6

Workaround

concatenate empty string before getNthRecord to ensure it references correct record.

Outcomes