8 Replies Latest reply on Feb 4, 2014 3:28 PM by LaRetta_1

    GetNthRecord, used in Script Parameter Calculation fails to return correct value

    philmodjunk

      Summary

      GetNthRecord, used in Script Parameter Calculation fails to return correct value

      Product

      FileMaker Pro

      Version

      11.03

      Operating system version

      Windows 7

      Description of the issue

      When using GetNthRecord to return a value from a related table inside a calculated script parameter, it returns a value from the first related record instead of the Nth Record.

      Steps to reproduce the problem

      I'm using this calculation inside the script parameter box:
      List ( GetNthRecord (Dates::DateField ; $$RecordNumber ) ; 1 )
      The related records in Date are:
      8/3/2011
      8/10/2011

      and $$RecordNumber = 2

      If I put GetNthRecord ( Dates::Datefield ; $$RecordNumber ) in the data viewer, I can confirm that 8/10/2011 is returned just before I click the button that passes this parameter to my script. Using the debugger to halt the script on its first line of code, shows that it still evaluates as 8/10/2011, but Get ( ScriptParameter ) returns: 8/3/2011¶1.

      Expected result

      8/10/2011¶1

      Actual result

      8/3/2011¶1

      Workaround

      Use steps within the script to find and access the Nth related record in this table.

      GetValue ( List ( Dates::dateField ) ; $$RecordNumber ) is also an alternative that occurs to me while typing this report, but have yet to test that approach...