May 19, 200223 yr I run a find in a script, but want to run it w/out dialogue. For instace, when it doesn't find anything, i want it to skip that step and move on. I know you have to do something with error capture. Thanks -j
May 19, 200223 yr After: Perform find [] try something like: If ["Status (CurrentFoundCount) = 0"] this should happen Else do this End if
May 20, 200223 yr Cretae a global number field in your database to store the error code -- " gError". Script steps would then be: Enter Find Mode [] <stuff to make find requests> Set Error Capture [on] Perform Find [] Set Field [gError, Status(CurrentError)] Set Error Capture [off] If [gError = 0] # stuff when records found Else # the find step generated an error of some sort If [gError = 401] # no records match this request <script stuff when no records found> Else # some other error, may indicate a problem <script stuff when a real find error occurs> End If End If Note in the script that I have included conditionals to work out when no records are found, and another when some other error occurs. For instance, error 400 is "Find criteria is empty" -- you probably don't want to do your <no records found> script steps when in actual fact the user clicked the Find button without typing anything! That's called Defensive coding. For instance, the script could be expanded to handle this instance... If [gError = 0] # stuff when records found Else # the find step generated an error of some sort If [gError = 401] # no records match this request <script stuff when no records found> Else If [gError = 400] # no find criteria <script stuff when no criteria entered> Else # some other error, may indicate a problem <script stuff when some other unexpected error occurs> End If End If End If
Create an account or sign in to comment