jansenw Posted February 18, 2009 Posted February 18, 2009 What's the best way to implement a unique dual key index (SQL terms) in FMPro? For example, a company_contact table: with 2 key fields: CompanyID and ContactID CompanyID ContactID ------------------- COMP-001 CONT-001 COMP-001 CONT-002 COMP-001 CONT-002 not allowed (duuplicate) COMP-002 CONT-001 COMP-002 CONT-004 COMP-003 CONT-005 COMP-004 CONT-002 etc. - Jansen
Newbies RobertTaylor66 Posted February 18, 2009 Newbies Posted February 18, 2009 Create a new field of type text. This field will serve as the unique key. Add a field calculation of something like CompanyID & "|" & ContactID. Uncheck the "Do not replace existing value for field" option. Check the "Prohibit modification of value during date entry" option. Check the "Not Empty" and "Unique Value" validation options.
jansenw Posted February 20, 2009 Author Posted February 20, 2009 RobertTaylor66, One of us must be mixed up. How do you access the following options you mentioned for a "Calculation" type field? 1. "Do not replace existing value for field" 2. "Prohibit modification of value during date entry" 3. "Not Empty" 4. "Unique Value"
Newbies RobertTaylor66 Posted February 20, 2009 Newbies Posted February 20, 2009 Please re-read my post. You do NOT want a calculation field. You want a Text field with a calculation (defined on the Auto-Enter tab of the field options dialog). The goal is to create a third field that will automatically be the concatenation of the two other fields. This third field will will enforce the uniqueness for your design.
Recommended Posts
This topic is 5814 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