Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to Make a Compound Key?

Featured Replies

  • Newbies

I am making a very simple database to track residents and their co-signers and their payments for the apartment building that I run. Since it is possible for two or more people to have the same first and last names, I hope to create a compound key in the 'people' table that uses the first name, last name, plus a date to come up with a unique identifier that will only apply to the person in each record.

 

Anyone that can tell me how to do this in FMP 11 is invited to coffee and breakfast and/or sushi in Berkeley, California, or....(you tell me what you want)?

Use an auto enter serial number. It will be unique to each record. Otherwise if you want to know how to do what you asked use an auto enter calculation 

first name & " "  & last name  & " " & Get ( CurrentDate ). Make sure to not check the do not replace because you will want it to change if you alter the spelling of a name.

  • Author
  • Newbies

Brooks— many thanks for thinking about this for me. 

 

I defined a new field as 'calculation' and entered the string you provided: 

 

first name & " "  & last name  & " " & Get ( CurrentDate )

 

When I go to save the field I get this message:

 

An operator (e.g. +, -, *, …) is expected here.

You should really take Brooks' first suggestion to use an auto-enter serial number more seriously. ID numbers don't have to tell you any information about your residents; that's what the rest of your database is for.

You don't want a field as a calculation.

Set it as text.

Select Options.

On the first tab of the field options box is Auto-Enter

Choose auto-Enter Calculation

I used the field names you provided. You should use the field selection box in the calculation window and double click the fields you want as you may have typed something different. Use the operators from the middle of the dialog window. 

 

Again I would stress that this is BAD way to make a primary key. You really should use a auto-enter serial ID

  • Author
  • Newbies

Okay, I'll take both of you guys' word for it and use a serial #. The reason I wanted to use names was for search purposes.

Combining fields for better a better UI presentation is done all the time. And you can use what I've told you so far, however your original question  sounded like you were asking about a primary key, and if you don't know what that is name a field id and use the serial auto-enter, and you will learn about it later. It sounds like you are on your very first relational database experience. Relational databases are not excel, ( although you can technically use a table like that. ) Filemaker has many great tutorials all over the net for learning about the relational aspect. The best advice I would give you is to join filemaker technet for $100  and you will get their very comprehensive training program for free. There are also many great books out there for under $30. This forum is where you will get lots of help understanding what you are trying to do or learning, but not for the actual training material. Good luck!

To satisfy your search needs, Find mode and Quick Find can almost surely do what you want without needing a compound field.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.