Jump 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.

Composite Primary Keys in Filemaker

Featured Replies

  • Newbies

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).]

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

  • 2 weeks later...
  • Newbies

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.

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

Create an account or sign in to comment

Important Information

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

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.