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.

Need help to create a composite key

Featured Replies

I am sure there is a simple way to do this but I am brand new (1.5 days) to filemaker. I have some experience with SQL Server and Access but no Filemaker. I am having a problem creating a composite key. What I want to do is have a table that does not allow data to be entered when the information in two seperate fields are the same.

An example would be 3 tables-Class, Student, ClassMember. ClassMember would be the entity that matched up a student with a class but I want to prevent having records in ClassMember that have identical Student and Class information in it. I don't want to have multiple records with the same info in them. A student can be in many classes and a class can have many students but I don't want to be able to enter the student in the same class twice.

Thanks in advance for all your help.

I have a sample file that shows the way I do this. I use a one to many relationship from Class to ClassMember and a one to many from Student to ClassMember. I use a one to one relationship to create new records in ClassMember. This is an AND relationship. I use a value list which shows only Class Student pairs that have not been used.

Try a self-join on the ClassMember table using both StudentID AND Class ID. If when you go to add a new ClassMember, there is already a related record, then you can show an error.

The specifics about how to go about this validation depends on how you're adding records. If you use a global for adding a Student to a Class (or a Class to a Student,) then the relationship would use this global for one of the fields on the parent side, and the validation would be a script that just checks if the related key is empty before adding the actual record in the ClassMember table. In this case a global representing the new ClassID would reside in Student or a global representing the new StudentID would reside in Class, and the relationship would be from that table to the ClassMember table.

If you add the records by filling in a row of a portal, then this can be more tricky.

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.