You could sort the relationship instead of sorting the portal. That way the first record of the portal will be the same of the table.
Thank you for your suggestion but I don't think that would work as the portal is not sorted, it is filtered, and I am not sorting the relationship or the portal.
However, once the list is down to one item, I cannot seem to grab the data from that row. If I use get nth record(field;1), it returns the first entry of the table and not the first entry of the portal.Which is why the row in the portal is setup as a button so that you can complete the selection process by clicking it.Have you tried enabling "auto-complete" for this field, possibly with a value list and a drop down list format?Here's an example:
FileMaker 12 users: https://dl.dropbox.com/u/78737945/SimpleNameLookupDemo.fmp12
Pre FileMaker 12 Users: https://dl.dropbox.com/u/78737945/SimpleNameLookupDemo.fp7
For what I have understood, you have to use
Go To Portal Row [Select;First] (if you have just one line in the portal), Then copy the field
Hmm good idea, but how does the script determine that you have narrowed down the list to one matching item?
Another option is to use a custom function or other calculation to "explode" the search text in the portal table into a return separated list.
If your text were "Apple", the text returned by this calculation would be:
You could then dispense with the portal filter and use your search field in the layout's table as a match field to this return separated list and now you no longer have to deal with the limitations of a portal filter. (This is how we did this prior to the Portal Filter feature added in FileMaker 11.)
He said that the user has to type enough characters to down the list to one item.
To make it automatic it can do something like that:
Go to Portal Row [first]
$r1 = Get ( ActivePortalRowNumber )
Go to Portal Row [Last]
$r2 = Get ( ActivePortalRowNumber )
If ($r1 = $r2 ) ONE PORTAL ROW
Thank you. That worked.
I have created a script trigger so that when the filter field is exited, the script is triggered to copy the first portal row into another field.
I don't need the script to determine when the list is down to one row as the script trigger only is invoked when the field is exited ie. the user will exit the field when only one entry is left in the list.