On what table is your master layout based?
What exact relationship did you define to link that table to your child table?. (I know you said you used a global field, [you said variable, but since you can't link by a variable, I'm assuming you meant a global field], but exactly how did you use it to relate to the records in the Child table?)
Did you place fields from the child table on your layout to display the data from the child table or did you use some other fields?
BTW, another approach is to base your master list layout on the same data source table as your portal, then use Go To Related Record or a Scripted Find to find the clicked record for your masterlist layout to display.
Hi PMJ, Thanks for the reply. Layout is based on Master table. Yes, I mean a global variable, set up in the Master table. The fields listed on the master layout that I need to view / edit come from the Child table that has the link by global variable (i.e. It should select only one record based on the value of the global field, set by the script). The portal comes from the other copy of the child table, these two are the only copies. The portal filters on a linked field in the master table (not the same field as the global field). Both child tables are linked by =. I have tried setting the global field by either field by name, and set variable, then refresh window and / or commit record. Nada. I am using the trial version and intend to purchase FMP once I can get this to work. Ten days left!! I can upload a jpg of this layout and link relationship if that makes it easier. Henry
Note, I mean that both child tables are linked to the master table, not to each other. This iPad refuses to recognise carriage returns in the text field on this forum. Sorry for that.
Global variables and global fields are two different things in FileMaker. A minor quibble, but the details can hang you in database development if you get them wrong.
And Data Source tables and table Occurrences are two different things as well. The boxes in Manage | database | relationships are table occurrences. The tables listed on the tables tab and in tables drop down on the fields tab are data source tables. When you create a new data source table, fileMaker makes a table occurrence and a layout of the same name. I can only assume that when you say you have a "copy of the child table" you are describing two table occurrences of the same data source table.
Let's say you have these relationships:
MasterTable::AnyField X AllChildRecords::anyField
Then a Portal to AllchildRecords will display all records except for any excluded by a portal filter expression on the Portal.
Let's assume you also have this relationship:
MasterTable::gSelectedID = SelectedChildRecord::PrimaryKey
Where gSelectedID is a number field with global storage specified and AllChildRecords and SelectedChildRecord are two table occurrences of the same data source table.
If you have all that set up, then you can add fields from SelectedChildRecord to your MasterTable layout and the following script can be attached to your portal's button:
set Field [MasterTable::gSelectedID ; AllChildRecords::PrimaryKey ]
And if you want, you can select all the fields inside your portal row while in layout mode and use Button Setup... to turn the entire row to perform this script instead of adding a button next to it. That assumes you don't also need to click into the portal rows and edit them while in this portal.
If "Table Occurrence" is a new term, you may want to check out this thread:
Ok.... figured it out.... The "monkeys and Shakespeare" syndrome more than any intelligence here... Thanks PMJ for your guidance. Henry