tobbesfilemaker Posted June 27, 2012 Posted June 27, 2012 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?
Vaughan Posted June 27, 2012 Posted June 27, 2012 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. 1
tobbesfilemaker Posted June 27, 2012 Author Posted June 27, 2012 yes but the foreign key, should it be auto enter serial aswell or just a number?
Lem Alpha Posted June 27, 2012 Posted June 27, 2012 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. 1
bcooney Posted June 27, 2012 Posted June 27, 2012 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.
Recommended Posts
This topic is 4592 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now