I have 3 tables (for clarity am only listing some fields):
Table 1 (ID, Description1)
Table 2 (ID, Description2)
Table 3 (ID, Table1ID, Table2ID)
Essentially I am using Table 3 to create a many-to-many join (and have linked the various IDs through the relationships tab and set the ID fields to be autocreated). I want to be able to create a layout with all records from Table 1 and allow a user to select 0 to n items from Table 2 in a dropdown.
So far I have a layout that contains the Table 1 Description 1 field and have tried putting a portal with the Description 2 field from Table 2. I then changed the control style to dropdown through the inspector and Table 2 in the Values from: property.
I am not sure if this is even possible or the correct approach. I was hoping Filemaker would use the relationship graph and create the necessary records (essentially entries in Table 3 linking the two together), but I receive the following error: “This operation cannot be performed because one or more required related records are not available and cannot be created.“
Any help would be appreciated and please go easy on the Filemaker newbie :o)
The first step is to create your value list (and that is not a part of the relationship graph). You do this at File > Manage > Value Lists.
You can create a new value list and tell it to Use values from field (first radio option, not selected in image):
Once in the Use values from field dialogue, you can select to also display values from a second field (the id is the first, the description is 2nd), include all values, and only show values from the first field (to hide the id from the user).
You are correct that your relationship graph will do the work of creating related records and filling in the keys for you. It should look like this:
It is important that the ‘Allow creation of records in this table via this relationship‘ is checked in your relationship, exactly as follows:
Your layout, as you said, is based on table one and your portal looks at table three. The ‘Show vertical scrollbar‘ will allow you to create an unlimited number of related records. Without that option selected, you are limited to the number of rows in the portal.
That is it. Save your layout, create a record in table one, and you can create related records through your relationship graph with no scripting needed.
You are storing the id and displaying the description.