Assuming this is a parent (person) - child (layout table) relationship, you don't need a portal to display the name or other fields from the parent; fields from a related table (outside a portal) always come from the first related record, which is fine if there is only one.
Just put a button into the sub-summary part with
Find Matching Records [ TheLayoutTable::foreignKeyForPerson ; replace ]
If the button is in the same row as the name does filemaker know to get the name from the name field of the current portal row?
A given reference is resolved using the current context; i.e. Parent::id has different values in different child records, and again on a layout based on parent itself. FileMaker knows how to find 'it', if you tell it where to look.
Hi Erolst, I have a button with find matching records, but it seems that is it remembering the last search if that makes sense. Press the button and it will work the first time. Every time after it then always goes back to the results of the first search. I tried adding a layout on exit script to show all records, but still gives the same results.
Ok its doing something else now. I press the button beside the record, it goes to a 2nd layout and finds matching records based on ID then on that layout it will have an active record selected. Go back to the first layout and search again with a different record and it will always find the previous active record from the 2nd layout.
$currentPerson = getfield ( name )
is not correct usage. This use content of name field as field name to get its value.
$currentPerson = name
get the name field contents.
If you use the function to get field contents,
$currentPerson = getfield ( "name" )
In some context you need table name prefixed as "table::name"