Jump to content

FM7 - Scripting error capture


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

Recommended Posts

Hi,

I've set up a script for a user to add another record (unique) in a related db. What I want to amend the script to do is throw up a message if the field is not unique. I'm trying to use the Get(Last Error) = 11 but i suspect this is SQL only???

I know I could script a search and if result = 1 run it, but was wondering if there was an easier (shorter) way to script it??

Link to comment
Share on other sites

It's just a standard text field.

I think I'm doing it the wrong way around, before I create the record I should test if the global value already exists in the table??? I have the field validated to be unique.

Show Custom Dialog [Enter New Industry; gInput]

Go To Layout Industry

Create New Record

Set Field Industry; gInput

Commit Records 

(this is where I really need it to say if(Get (Last Error) = 11 show dialog "error record already exists" and roll it back?:)

Link to comment
Share on other sites

Before I create the record I should test if the global value already exists in the table?

Yes! It's much easier this way. Just create a relationship between gInput and Industry. Then after the Show Custom Dialog step, add If [isEmpty(relationship::Industry)] before creating a new record. If the test is true, there is no related Industry. If it's false, one already exists.

Link to comment
Share on other sites

This topic is 7007 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.