2 Replies Latest reply on Mar 4, 2013 12:56 PM by philmodjunk

    Find requests with saved $vars in them fail

    DarrenTerry

      Summary

      Find requests with saved $vars in them fail

      Product

      FileMaker Pro

      Version

      12.0v3

      Operating system version

      Mac OS X 10.7.4

      Description of the issue

      A Perform Find script step that restores a find request that includes a $var sometimes works, and sometimes fails.

      Steps to reproduce the problem

      Build a database with at least 1 text field.  Populate several records with people's names in the text field (values like "John Smith", "Darren Terry", etc).  Create a script with 2 steps:

      Set Variable [ $name ; "Darren Terry" ] <-- or whatever name value you want
      Perform Find [ Restore ]
      //# where the find is restoring a find request with $name in the Name field only.

      Expected result

      The find should work, locating the record(s) that match the contents of the variable.

      Actual result

      In my experience, 50/50 that it will work or will fail inexplicably.  Modifying the last find when it fails shows the correct value in the field, and then performing that find will (usually) cause it to work suddenly.

      I believe that the functionality of supporting $vars directly in find requests isn't fully baked in FMP12.

      Configuration information

      MacBook Pro 17", 2.5 GHz Intel Core i7, 8 GB 1333 MHz DDR3, SSD

      Workaround

      The workaround is to do this instead:

      Enter Find Mode []
      Set Field [ Name ; $name ]
      Perform Find []

      In other words, don't restore a find request with the variable in it. Instead, explicitly go to FInd Mode and set the field to $name, then perform that find.  This universally works.

        • 1. Re: Find requests with saved $vars in them fail

               DTerry1:

               Thank you for the post.

                

               I created a new database with with one field and five names as the values. I wrote the following script:

                

               Set Variable [ $name ; "John Smith" ]

               Perform Find [Restore]

                

               The find request was specified for the 1 field and the criteria was $name.

                

               I ran the script 30 times:

                

               1. Ten times in table view. Twice from each record.

               2. Ten times in list view. Twice from each record. 

               3. Ten times in form view. Twice from each record. 

                

               The find was successful 30/30 times. I was using FileMaker Pro 12.0v3 on Mac OS X 10.7.4.

                

               Perhaps I am missing a step to replicate?

                

               TSFalcon

               FileMaker, Inc.

          • 2. Re: Find requests with saved $vars in them fail
            philmodjunk

                 Strange find results can be due to a damaged index. You might try rebuilding the indexes in your field to see if that corrects the problem.

                 To rebuild the index of a single field:

                   
            1.           Open Manage | Database | Fields and double click the field
            2.      
            3.           Use either the storage tab or the storage options button to turn off indexing.
            4.      
            5.           Exit Manage | Database, then return and turn indexing back on.

                  

                 You can also rebuild all your file's indexes by importing all the data into an empty copy (clone) of your file.

                 If you have FileMaker 11 or newer, you can use Advanced Recovery options to rebuild your file's indexes:

                   
            1.           With the file closed, select Recover from the File Menu.
            2.      
            3.           Select "Use advanced Options"
            4.      
            5.           Select only: "Copy File Blocks as-is" and "Rebuild Field Indexes Now".