1 Reply Latest reply on Aug 31, 2010 3:03 PM by philmodjunk

    Go To Related Record Record script step not working for "0" matches

    rileyrl

      Summary

      Go To Related Record Record script step not working for "0" matches

      Product

      FileMaker Pro

      Version

      11.2

      Operating system version

      Macbook Snow Leopard

      Description of the issue

      The script step, "Go To Related Record Show only related records", is not working correctly and gives the wrong answer in the following situation:

      One file, multiple tables.
      Zero case: There is no match, no related records.

      This command has always worked fine when the related table was external.  The table in question would have the following result: "0/Total#OfRecords".  If ErrorCapture was set to "on" then this command could be followed by "If (Get(FoundCount) = 0) then ..." so that the script could deal effectively with the case of zero matches.

      The same situation does NOT give the correct result if both tables are in the same file.  The command works fine if it finds a match, but if it finds zero matches it does NOT give "0/Total#ofRecords" INSTEAD the result is whatever is was to begin with, in other words, it does not change the found count to zero.

      The Get(FoundCount) result is then wrong and the script "If" test doesn't work.

      Steps to reproduce the problem

      Define two tables in one file.  Create a relationship between them (Num fields).  Create one layout for each table.  Create some records so that SOME of the records in the 1st table have matching records in the second table, but some do NOT.

      Create a script that has the following commands:

      Go to Layout [<1st layout based on Table1>]
      Go to Related Record[ Show only related records; From table ; Using layout <2nd layout based on Table2>]
      Go to Layout [ <2nd layout based on Table2>]
      If [ Get(FoundCount) = 0 ]
         Pause Script
      EndIf

      Test this script on records in Table1 that do NOT have a match.

      Expected result

      The results for the Table2 layout should read "0/Total#OfRecords" and the script should Pause.

      Actual result

      The result in the Table2 layout does NOT say "0" and the script does not pause.

      Exact text of any error message(s) that appear

      No error message, or notification of zero matches, even though "Set error capture" was not used.

      Configuration information

      The actual file has 8 tables and the "Go to Related Record" command doesn't work in any other zero-match case either.

      This same situation has always worked correctly if the 2nd table is in an EXTERNAL file.

      Workaround

      I have to test the Count function (=0) 1st and bypass the "Go to Related Record" command, if I am using a one to many match.  I have to test on a summary field of a count field to bypass the command in a many to many match.

      However, I am trying to consolidate a huge solution and it is impractical to find all these and fix them all.