kiwiora Posted January 20, 2005 Posted January 20, 2005 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??
-Queue- Posted January 20, 2005 Posted January 20, 2005 What does your script look like and which field is being tested?
kiwiora Posted January 21, 2005 Author Posted January 21, 2005 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?:)
-Queue- Posted January 21, 2005 Posted January 21, 2005 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.
kiwiora Posted January 21, 2005 Author Posted January 21, 2005 thanks! I'll re-write when I get back to work after the long weekend.. ahhhh such is life with salary payments
Recommended Posts
This topic is 7249 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 accountSign in
Already have an account? Sign in here.
Sign In Now