Billy Bob Posted October 22, 2006 Posted October 22, 2006 For various reasons I have to duplicate some information in my database. I've made a script that takes details from one record and uses them as the basis for a new record elsewhere in the database. My question is: can I add some kind of failsafe to stop me inadvertantly creating a new record with the same information twice? There are two key fields - 'Date' and 'Supplier' - that I've been trying to use to acheive this. Each of fields does not contain a unique value, but the pairings of these two fields are always unique - for example, there would only ever be one instance of '01/01/2006 and Acme Supplier'. I have been trying to create an 'If' script step along the lines of... 'If ths combination of ''Date and Supplier'' already exists then don't add a new record' ...but I can't figure out the FM language to make it happen. Does anybody have any suggestions?
Ender Posted October 22, 2006 Posted October 22, 2006 Add another table occurence of the table, and define a relationship between them: table <=> table self_join = table::Date = table self_join::Date AND table::Supplier = table self_join::Supplier You can then count the number of records that have the same Date and Supplier by using a Count() function: Same Date_Supplier Count (calculation, number result) = Count(table self_join::recordID) If this count is more than 1, then a duplicate exists.
Billy Bob Posted October 22, 2006 Author Posted October 22, 2006 Hi Ender. Thanks - I'll try that this afternoon and let you know how it goes.
Recommended Posts
This topic is 6609 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