June 27, 201213 yr Hey, hope this is in the right section. I got 2 tables, Customers and Invoices.. one to many in my situation, customer can have many invoices, one invoice can only belong to one customer.. I`ve already made a primary key in both tables, customers_ID and invoices_ID. Do i put my foreign key in the "many" side of the relationship? And also I wonder if a foreign key should be just be a number or should it auto enter serial number 1 to 1 like the primary key fields?
June 27, 201213 yr Techinically you only need the primary key in the Contacts table. Make a Contacts foreign key in Invoices and its all good. You also need an Invoice primary key, but not for the relationship between contacts and invoices. The Invoices primary key would be used to link the LineItems to Invoices.
June 27, 201213 yr Author yes but the foreign key, should it be auto enter serial aswell or just a number?
June 27, 201213 yr Hi there, the foreign key CANNOT be an auto enter serial number, by design. First of all, without any Filemaker technical considerations, and just out of pure logic : this foreign key is part of the link between the two tables, but in order to be "automatically entered", the link would somehow have to be already set, just to know which record of the other table it should be linked to... As we say in french : "that's the snake eating his own tail..." So you'll have to set this foreign key either manually or by script.
June 27, 201213 yr This demo might help to show you how relationships are built and how you can create a new invoice from a customer record using a script that populates the foreign key.
Create an account or sign in to comment