Newbies mlenny Posted February 8, 2001 Newbies Posted February 8, 2001 I'm new to FM and coming from 9 months reading general DB theory - now hitting problems transferring theory into FM. How can I implement a composite primary key in FM? In other words, several fields whose values singularly are not unique, but whose combined value must be unique, to be used as a match field in a related file. An example is my current problem: a software database with developer, title and version fields, e.g. 'Microsoft' 'Word' and '5.1'. None of these values are necessarily unique. However, I want the three combined ('Microsoft Word 5.1') to be unique, so the same package does not get entered more than once. I can make a calculation field using concatenation to combine them, but how can I then validate that result as being unique? This might not even be the right approach, so all suggestions welcome. [This message has been edited by mlenny (edited February 08, 2001).] [This message has been edited by mlenny (edited February 08, 2001).]
dspires Posted February 9, 2001 Posted February 9, 2001 One option, assuming FMP interface and not a CDML solution, is to concat the field as you described and create a self relationship (to the same database) based on the calculated field, call it 'unique'. Create a field called 'alert_check' based on the relationship (doesn't have to be on the layout). Create a calculated field called 'alert' as follows: If( Count(unique::alert_check) > 1, "Your alert message goes here!!!", "") Place this field on the layout with whatever notification message you want. HTH
Newbies balrog Posted February 21, 2001 Newbies Posted February 21, 2001 Is there a simpler way of forcing a concatinated field to be unique? If you set the field to be unique it wont let you enter a value that isnt unique but it will allow a calculated one.
wildsicilian Posted February 26, 2001 Posted February 26, 2001 Have you tried something as simple as making a new field (call it unique) which is a text calculation and must be unique as follows: unique=fieldA&fieldB&fieldC&fieldD&fieldE This field would not have to appear on the layout but would alert you if the 5 fields when combined duplicated another record in the file. ------------------ Kathy Eldredge the Wild Sicilian
Recommended Posts
This topic is 8671 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