1 Reply Latest reply on Jul 1, 2013 8:09 AM by philmodjunk

    Find Script

    obidon

      Title

      Find Script

      Post

           Afternoon

           I have a button for find.  I'd like this button to do 3 things.  

             
      1.           `Find All` when all records are not in the found set.  I have created a global field - If (  Get ( TotalRecordCount )  > Get ( FoundCount )   ; "Show All" ; "Find" ) to provide a label. This isn't working yet but close.  Anything wrong in my calc?
      2.      
      3.           When all records are shown I want the button to provide 'enter find mode' from browse and then double to acts as the continue or perform find next step. My script is in the screenshot

             

      Screen_Shot_2013-07-01_at_15.43.13.png

        • 1. Re: Find Script
          philmodjunk

                If (  Get ( TotalRecordCount )  > Get ( FoundCount )   ; "Show All" ; "Find" )

               Does not exist in the script that you posted.

               The Set Error capture step should be moved up to precede the Perform FInd step. Otherwise, your script will be interrupted with a "no records found" dialog from FIleMaker if no records are found.

               As written, get ( LastError ) is always returning a 0 because the set error capture statement is always executing without generating an error code. Get ( LastError ) returns any error codes generated only by the script step that immediately precedes it.

               You may also find some of the script examples in this thread on scripted finds of interest: Scripted Find Examples