2 Replies Latest reply on Oct 26, 2010 8:32 AM by wkparkjoe

    FMI script perform search returning no records

    wkparkjoe

      Title

      FMI script perform search returning no records

      Post

      I need to come up with a logic in a script where I can count the records for a certain search criteria. If there are no records then I want to run another script that goes back ot the main layout. Currently when I run the script I have set I do the following:

      If [Get ( CurrentPrivilegeSetName ) = "User 1"]
        Perform Find [Restore]
        Set Variable [$recordcount; Value:Get ( FoundCount )]
        If [$recordcount = 0]
          Show All Records
          Perform Script ["Goto Entry Screen"]
        End If
      End If

      If I run this script and there are no records found in the Perform Find, on the FMI web page I am stuck in a search. I would rather be able to do a count first if possible then do a Perform Find. Is there a way to do this? Thanks!

        • 1. Re: FMI script perform search returning no records
          philmodjunk

          By "stuck in a search" you mean that you get a dialog popping up that no records where found with an offer to either modify or cancel the find?

          Try this variant of your script:

          If [Get ( CurrentPrivilegeSetName ) = "User 1"]
            Set Error Capture [on]
            Perform Find [Restore]
            If [Get ( FoundCount )= 0]
              Show All Records
              Perform Script ["Goto Entry Screen"]
            End If
          End If

          Set error capture will supress the error dialog. You don't have to change the use of $recordcount to capture the number of records in your found count if you don't want to, it just seemed redundant to me within the scope of your original post.

          • 2. Re: FMI script perform search returning no records
            wkparkjoe

            Hi Phil,

            The Set Error Capture is what did it. Thank you for your post. I ment to say IWP instead of FMI. On IWP, when you do a find and zero records are returned, instead of a dialog box or error message stating no records found, you get stuck in Find Mode and you have to go back into Browse mode. Doing Set Error Capture On fixes that because as you states it supresses the error and since IWP can't display dialog boxes, allows the script to continue on. That's a big plus with the scripting system to do Error Capture. Thanks again.