dougL Posted June 14, 2013 Posted June 14, 2013 Hi, I'm writing a script to add "sessions" to my database. Each session has "Session Date" and "Session Time" fields associated with it. I'd like to prevent the user from adding another record with the exact same date and time. I've created a third field with the date and time combined as a unique identifier. I'm wondering what the best way is to compare this date/time field to existing records during record creation to make sure it doesn't already exist in the database. I imagine this is a fairly simple and straight forward problem but I can't seem to get a grasp on it at the moment with my current FM knowledge. Thanks
bcooney Posted June 14, 2013 Posted June 14, 2013 You don't really need the combo field. Script the record creation. Have users enter a "new record" into global fields and click "Create." That script will use the global values to "find" and see if such a record already exists. If so, it tells the user and doesn't create the new record. Other methods exist too, but this is my preferred.
dougL Posted June 14, 2013 Author Posted June 14, 2013 Thanks for the quick response. I'm not sure I totally understand. Do you mean that I should make the Session Date and Session Time fields global? By "Create" do you mean Commit the records? Sorry for my naivety. You don't really need the combo field. Script the record creation. Have users enter a "new record" into global fields and click "Create." That script will use the global values to "find" and see if such a record already exists. If so, it tells the user and doesn't create the new record. Other methods exist too, but this is my preferred.
Mr. Scott Posted June 14, 2013 Posted June 14, 2013 Hi, Doug: I think what bcooney said was to create two GLOBAL fields to as intermediate data entry placeholders. The "Create" button she suggested runs a script that grabs the values in the GLOBAL fields, then uses them to perform a "Find" for the existence of such a record. If FoundCount = 0, it creates a new record and populates it with the data you have from the GLOBAL fields. - - Scott
dougL Posted June 15, 2013 Author Posted June 15, 2013 Thanks Scott. That makes more sense now. I'll try it out.
Recommended Posts
This topic is 4179 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