SearchResults

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:

  1. FileMaker can only search fields on the layout, meaning you could easily miss records, and searching related fields can be slow.
  2. Results are returned on the same layout, rather than switching to a list view if more than 1 record is returned.
  3. 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...

1. In your file, select Tools/ Custom Menus / Manage Custom Menus.
2. You'll arrive at a screen with two tabs at the top: Custom Menu Sets and Custom Menus. Select Custom Menu Sets first. If you already have a custom menu set you're using, you'll edit it, if not, you'll edit Custom Menu Set 1. You may want to select it on this screen and select edit to rename it. larger image
3. While on the Custom Menu Sets tab, use the setting at the bottom of the screen to change the "default menu set for this file" from Standard FileMaker Menus to Custom Menu Set 1 (or to your new name if you renamed it).
4. Now select Custom Menus at the top of the screen and find the Records Copy menu: select it and click edit. If your file was created in FileMaker 11 you'll see a menu here for Perform Quick Find: it will be the last menu item: highlight it. If your file was create in an earlier version of FileMaker, you won't see it so click "Create".
5. Edit the item so that it matches the screen shot below. larger image
6. That's it. Manually select your new menu from the tools menu (if you set the new menu to be your default in step 3 you won't have to do this when you next reopen the file). Enter some text in quick find and it will run that text through fmSearchResults.

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:

Note where we've put these new lines: right before the "Load Integration Settings" comment.
If you implement something like this, remember that you can still search your data for urls: just leave out the www part.
The help system script is just an example. They key here is that with this mod in place, once fmSearchResults' "Search" script is running, what was entered into QuickFind is now in "SR_searchString" and you can branch your script's behavior by testing its contents.

Enjoy!

(855) SEEDCODE
[email protected]
Follow us: