Jump to content
Server Maintenance This Week. ×

How to generate multiple keys?


ralfelvin

This topic is 6210 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi,

I am desiging a relational data modell in FM. Most of my objects need two attributes as a sufficient key, e.g.:) I cannot only use the name but have additionally to use the age of a person. so those two attributes should serve as one key.

My question is, how I can do that in FileMaker. Does FM offer Multiple Keys (and a Multiple Key has not to be mistaken for a multi-key field, which is something different).

Thank You

Ralf from Kampala / Uganda

Link to comment
Share on other sites

cannot only use the name but have additionally to use the age of a person

... um isn't that potentially a bad idea? What if the persons name changes, and why would you use an age (an abitrary value) which is guarranteed to change as a primary key... unless you wanted to store seperate records for each person depending on their age, but at the same time, why would you use a name?

For Example

You enter a name: Jhon

You create 3 related records based on the name

Jhon, Jhon, Jhon

Then you realize you mispelt the jame Jhon and it should've been spelt John, what do you do? If you change it to John, your other 3 records cease to relate to your record.

In the same sense, a user's age would normally change each and every year.

Now, to actually answer your question...

You CAN relate any Table Occurance to any other Table Occurance by any number of Fields thereby creating a Multiple Key relationship, as opposed to combining values of one or more fields in one field and then relating to another single field which would be a multi-key field relationship.

In either case, despite being possible iit's highlghy unrecommended, you should be using a serial generated value for your primary key, not something the user can change.

Link to comment
Share on other sites

In FM6 and below, you would need to use a calc to build a concatenated key, like this:

Name_Age (calculation, text result) = Name & " " & Age

While I'd agree with Genx about the problems with relationships built on user data, there are often times when such relationships are needed. Not for the primary relationships, but for interface relationships and filtering.

Link to comment
Share on other sites

*******, i missed the FM 6 bit... i always forget to check version.

Often times when such relationships are needed. Not for the primary relationships, but for interface relationships and filtering.

Naturally :)

Link to comment
Share on other sites

This topic is 6210 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.