Quick Find In 11
How can I run fmSearchResults scripts from the Quick Find in FileMaker 11?
Overview.
This article shows you how to extend the power of FileMaker's built in Quick Find using fmSearchResults, the google-like search extension built in FileMaker Pro, though you can apply this to running your own scripts as well.
FileMaker 11 introduced a QuickFind area in the tool bar:
When you enter text into this area, fields on the current layout are searched and records matching your criteria are returned. This is cool, but leaves a few things to be desired:
- FileMaker can only search fields on the layout, meaning you could easily miss records, and searching related fields can be slow.
- Results are returned on the same layout, rather than switching to a list view if more than 1 record is returned.
- You can only "search" using this, whereas with a few modifications--and fmSearchResults--you can use the QuickFind to call up your help system, open urls, etc.
For these and other reasons, we recommend repointing the QuickFind routine so it runs the fmSearchResult script instead of running its own find routine.
Here's how to do it...
Details.
First, write a new script in your file. Add this right below the "Search" script from fmSearchResults. (If you haven't yet added fmSearchResults to your file, do that here.)
This is a really simple script, name it "Call FMSR from Quick Find":
Next, create a Custom Menu to call this script. You'll need FileMaker Advanced to do this, but if you don't have that you can send us your file and we'll add this menu for you (email it to support at seedcode.com).
Here is how to create your custom menu...
Going Further.
If you've already deployed fmSearchResults in your file may want to remove our search widget from your main windows but keep it on the search results window (the widget is our field, X button, and oval frame where you enter search text). This mod places the contents of the Quick Find inside our fmSearchResults widget so that if you show the results window with the tool bar hidden you can still see your search request.
Note that you lose quick find history (the list of previous searches available when you click the little triangle in the QuickFind area) when you modify the menu in this way. Hopefully FileMaker will fix this so no triangle shows up when there are no previous searches, or they'll find a way to let custom searches populate that list.
Finally, you can now have the QuickFind area do lots of things besides "search". fmSearchResults lets you modify the scripts behavior based on what kind of information is inside the Quick Find. In the example below we've modified the fmSearchResults script "Search" to open URLs or launch our help system depending on what kind of information is entered into QuickFind: larger image
A couple notes about this:
Enjoy!