September 28, 200718 yr Heres the problem, i am pretty sure i am doing everything correct but i cant get this to work. There are two layouts. There are two tables. Layout 1 - uses table 1 Layout 2 - uses table 2 I want to display a value on layout 2 from table 1. A relationship is required because layout 2 is associated with table2 not table 1. Primary key from table 1 is set to auto serial. I have a 1 to many relationship from table 1 primary key going to the foreign key of table 2. This should allow me to display values from table 1 on layout 2 which is associated with layout 2. correct? On layout 2 i have a field that is set to display values from primary key field from table 1. When in layout mode it looks like it is set up right as it shows :table1ID.pk. The problem is that when in brows mode the field is empty. Any ideas?
September 28, 200718 yr You would also need a value in a foreign key in table 2 which was exactly the same value as the value in the primary key in table 1. You must have this foreign key field already, else what did you build the relationship with? But did you put a value in it? It takes 2 keys with identical values (or containing an identical value in one of its multiple lines) to make a relationship, one on each side.
September 28, 200718 yr Author Yes i have the foreign key field already. However, i did not have a value in it. What would be the best way to make sure it always has the same value in it as the primary key from table1?
September 28, 200718 yr Go here: http://fmforums.com/forum/showtopic.php?tid/190391/post/267983/hl//fromsearch/1/#267983 hth
September 28, 200718 yr Author ok, i understand how to give the fk a value based on the first table. In that example the user selects the fk to use. I need filemaker to automatical take the value out of the primary key from table 1 and use it as the foregn key in table 2. I am not sure how to pass this value over without the user needing to do anything. This value will change when the record on table 1 is change.
September 28, 200718 yr Well, you can script it; put the current table1 primary key into a Variable (or global field), then go to the layout of table2, create a new record, set the table1_fk foreign key to the captured value, commit record, then return. Or you can enter data in a portal in table1, with the relationship* allowing creation of related records. *Based on the table1 key on both sides, table1::table1_pk = table2::table1_fk The phrase "without the user needing to do anything" is misleading; the user always has to do something, enter data or hit a button.
Create an account or sign in to comment