The FileMaker Find / Replace Command

From Dwayne Wright PMP
Certified FileMaker Developer

WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

** Personally, this command scares the daylights out of me for basic user access. I will post a "Dangers Of" article a little later. Exercise great control when working with this feature. ***

The find / replace command feature was added when FileMaker 6 rolled out. The feature can be found under the FileMaker 9 Edit menu and as a pair of script steps. Find / Replace allows you to find a string of text in one or more fields and replace it. A classic example could be when a company changes names after a merger. You want to find any reference to ABC Company in a number of fields and change it to the new name of XYZ Company.

Here is the dialog box for the Find/Replace feature when accessed from the Edit menu.

You have quite a few options with the find / replace command feature. You can start your search in a forward direction, a backward direction or all directions. That is to say if you choose forward and you are on record six, the find / replace will only function on records above record six. The reverse is true for backward. All directions will cover all records in the found set, regardless of the record you are on. The other options include ...

Match Case - Means that you are only looking for matching words with matching capitalization.

Match Whole Words Only - First this means that you have to have a whole word match. So FileMaker will not see a match with words that are within words. For example you could search for the word “file ”. In your found set you may have records with “file” and some with “FileMaker”. Whole word search will only find whole and complete word matches ( in this case, the word “file”).

Also Match Whole Words Only deals with strings bound by a word break. So you may also search for a sequence of words with a blank space or some other acceptable punctuation character. This means that you “file” specific search would see a match between file and file.com.

Search Across - This can mean something different based upon what mode ( browse, find or layout ) you are in when you activate the search. In Browse mode it can be used to search across just the current record or across all records in the found set. In find mode, it can actually search and replace text in your search request. Now that could lend to some very interesting scripting! In layout mode, you can search and replace text on the current layout.

Search Within - This means you can do a search / replace for just one specified field or for all the fields on the current layout.

Also have 4 different buttons you can click to activate the search / replace in 4 different ways. They are ...

Find Next ( goes to the next found match )

Replace & Find ( replaces the next match, then moves to find the next match )

Replace ( goes to the next found match and replaces )

Replace All ( replaces all matches )

The default setting for Find / Replace is for all records and all fields.

NOTE: A new feature / wrinkle regarding Find / Replace was added to the FileMaker 6.0.4 update!

Find/Replace menu command is now disabled in the Edit menu if menu access is limited by the current password or if a script is paused.

If the Status Area is hidden and locked in Form View, then Find/Replace menu command will be available only for the current record.

You may have noticed that I keep mentioning the Find / Replace menu command but haven’t spoken much about the related script steps. There are two script steps associated with this feature. The first is the Open Find / Replace script ( Open Menu Items family ). This script step is somewhat unimpressive. Basically, it does the same as using the menu command. It bring up the find / replace dialog box and is likely used in situations where FileMaker is running under Kiosk mode.

The second method of performing the Find / Replace script action is the Find / Replace script step. This step is found under the Editing family of script steps and can be performed with or without a dialog box.

So users running FileMaker 6.0v4 will have a different experience using Find / Replace than users of earlier versions. If the status area along the left side of the FileMaker screen is hidden and locked, then Find / Replace only works on the current record ( when executed from the menu or via the Open Find / Replace script step ). When you think about it, it makes a lot of sense. When the status area is hidden, the developer takes care of the record to record navigation. Without this tweak, the Find / Replace could be used to jump to another record outside of the developers built in navigation used when the status area is hidden. The same tweak is also now true for sorting and spell checking script steps.

For global find / replace actions for when the status area is hidden, use the Perform Find / Replace script step. It doesn’t change the way it works based upon the status area being seen or hidden. The Perform Find / Replace script step operates the same regardless of the status area setting. Find / Replace script step is also unaffected by menu access password restrictions.

You can also script toggle the status area if you want to have a user to be able to use the Open Find / Replace menu script command globally. I would think it would be easier to simply use the Perform Find / Replace script step but I thought it might be worth mentioning.

Also we should mention how Find / Replace works within Record Level Access settings. Just like how a user cannot manually change data in a field due to a record level access setting, their execution of Find / Replace won’t allow them to change that data either.

=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2008 - Dwayne Wright - dwaynewright.com

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.