FileMaker’s new Script Triggers allow you to achieve a Google-like type ahead search in FileMaker, searching through a Portal. Here is how to set something like this up based on a person’s first and last name.
The more letters you type…
The more the portal gets filtered…
Define a Search Field
Later we will tie a script trigger to this field.
Make it a Global Field
Create a Calculated Version of that Search Field
If(IsEmpty(Search by Persons Name); “0¶zzz”; Search by Persons Name & “¶” & Search by Persons Name & “zzz”)
Set the Calculated Result to ‘Text’
In the Portal Record create a calculated Search Field
Basically you want the last name on one line and then the full name on the second line. It could also look like this:
It could also look like this:
Last Name & ¶ &
First Name & ” ” & Last Name
This is so the search can look for both first name and last name.
Use the Calculated Version of the Search Fields on both sides in the Relationship
Use a Greater than and a Less than link to capture all people within that range. Tie it to a calculated field in the portal table that contains ‘First Name’ and ‘Last Name’ concatenated.
Create a Trigger Script
Trigger Script contents
On leaving the field, commit the record to update the portal
Tie the Script to a Trigger on the field, ‘OnObjectModify’
Now every time you type a letter, the search is fired off, narrowing the scope. This function can also work on a regular layout, without the portal filter. Instead of using the global field to filter, you just use it to feed a search.