Execlisys had a demo file for "as you type" filtered searching.
look for the "as you type" demo on that page. it's an FP7 file but the technique is the same in FMP12
you can use left global and a dual predicate search for the result portal.
g_search ≤ name
c_search ≥ name
where c_search = g_search & "zzz"
Define a Primary key in the table , person_id ( serial, unique, not null, non modifiable)
add a script to parse the result portal person_id to a global field ( or $$var)
The right side field can be a auto enter calculation e.g. first_name & (pilcrow symbol) & last_name to allow search against multiple fields
This construct can also be massaged to allow search with 2 strings in the same global e.g. al bou
The tips and tricks demo is Find process btw
Be aware that the script requires the refresh + flush; flush means all cache data so can have a very real (negative) impact on speed larger data sets
lookup.fmp12.zip 12.3 K
I used that demo to create the sample file I attached to this post. Works well...with the exception...when I click on a value that is displayed in the portal (say cat if the search term is c)...nothing happens, I need to click on that "cat" in the portal and have the related record diaplayed on the layout. I've tried setting the "button setup" to "go to related record" but nothing happens.
If you just want a "Go To This Record" button in the portal, that's easy. You NEED to start using primary keys as well though in your solutions. You should always have a unique serial number for stuff like this.
I've added a set of fields for you that should be in every table you have. Also added a quick "go to" script and button in your portal.
You said you already took care of the searching part, correct?
lookup.fmp12.zip 11.0 K
re-enforcing Mike's comment re primary keys
EVERY table MUST have a primary key defined: unique serial, not empty, unique, immutable
'Every' can be qualified as 'most', there are occasional tolerable exceptions such as a single record utitlity table
It is also an advantage to define the serial with an alpha prefix: L000001
Naming conventions vary, it is practical, readable, and constistent with ISO/IEC 11179, to use the same name as the table name format e.g. lookup_id
Others will have there own take on field naming conventions, particularly key naming
Thanks, Mike. I do have those fields in my REAL solution.
when I go to type into the "searchterm" field.. after each letter it bounces out and displays:
Before typing, press Tab or Click in a field, or choose the new record menu command
If I remove the script trigger "trigger refresh" the cursor stays in the field and does not update the list until I click out of the field.
That's a relief, and good to know!
Check your script, it's probably not placing the cursor back in the field at the end when complete.
I had placed the searchterm field on the layout from the #2 table….just like the portal. Needed to be the searchterm field from the original table….all is working now..
I can’t thank you enough.
The Henne Group
116 New Montgomery Street, Suite 812
San Francisco, CA 94105