Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5555 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Have a script that (or hopefully will have) that performs a search automatically on user opening a file. If their user name and current date already exist in a particular field, then the script goes to that record, which they will then amend. If the search returns no results then a new record is created.

How do I get a script step to say, "if no records found do x" and also how do I get the the dialogue for no records match this set to NOT appear.

Thanks.

Posted

How do I get a script step to say, "if no records found do x" and also how do I get the the dialogue for no records match this set to NOT appear.

The clue here is to use Set Error Capture to ON in your script. Error capture remains in effect until you do a Set Error Capture [OFF] or the script terminates, or passes to another script.

When error capture is on then you have control in the script. You must test for the last error using Get(LastError). Based on the number returned (see the help system for error codes) you can then direct you script accordingly - this will also suppress the standard FM dialog box, so you could use your own custom dialog too.

Posted

You probably will end up with this structure in your script:

Set Error Capture ON

Enter Find

Set Field AccountName , Get (AccountName)

Perform Find

If (GetFoundCount) = 0

do this

Else

do this

End If

Posted

Thanks very much gents. I've seen Set Error On many times in scripts and never saw the point to it. I do now. Problem solved.

Posted

The clue here is to use Set Error Capture to ON in your script. Error capture remains in effect until you do a Set Error Capture [OFF] or the script terminates, or passes to another script.

No. Error Capture state is passed on to all sub-scripts too.

I had a problem last week (exporting XML files from a container field) and the real problem was masked by a "Set Error Capture [on]" step in one of the dozens of scripts that the process called earlier in its running. Grrr.

My recommendation is to set error capture off after it's no longer required.

Posted

Thanks Vaughan - I stand corrected.

Personally I've always explicitly used Error capture ON in EVERY script so I would never have spotted that.

This topic is 5555 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.