1. fmTextConverter
    1. Converting Text with fmTextConverter
      1. Search Tips
      2. Splitting a list of search and replace terms
      3. Problem: Substrings
        1. Solution: Sort the lines in decreasing length
    2. Converting FileMaker Code with fmTextConverter
      1. FM → Convert Text → FM
      2. Encoding special XML characters
      3. Avoiding breaking the XML
    3. Reapplying the Current Conversion
    4. Managing your Text Conversions
      1. Saving your Conversions for Reuse later
      2. Applying an existing Text Conversion
      3. Multiple conversions / Killer Keyboard Mode
      4. Protecting your conversions against deletions
      5. Save your data before updating fmWorkMate!

fmTextConverter

fmTextConverter

There’s no better substitute

fmTextConverter lets you perform multiple text substitutions on a text.

fmTextConverter is basically a wrapper for the FileMaker Substitute function, and lets you specify a list of search and replace pairs, and then apply them all in one go.

fmTextConverter screenshot with instructions

[Indeed, you can also use it to construct a Substitute function by just using the Convert Text later button!]

Note: If you only want to perform a single search and replace fmCheckMate may be the better choice of tool.

Whilst fmTextConverter - as the name implies - is primarily for converting text, it equally excels at converting FileMaker code - the FileMaker code is simply converted to FileMaker XML text for the text conversion.

Converting Text with fmTextConverter

To create a new conversion in fmTextConverter:

  1. Create a new blank record with the New button
  2. Paste the text you want to convert into the Text field.
    • To insert FileMaker code as XML
      • you can use the Paste Text button ⌘3
      • or click in the field and use the menu command Edit > Paste FileMaker-Clipboard → XML ⌘⌥V
  3. Enter the search and replace terms.
    • If you have just a single list of search and replace pairs, you can easily split the list into search and replace terms
  4. Press the Convert text now button
    • The converted text will be shown in the Result field, and is already on the clipboard.
  5. If you want to convert the text back to FileMaker objects, press the → FM button.

or, using the keyboard shortcuts from the fmTextConverter app menu:

⌘C
Copy code from FileMaker
⌘2
New record in fmTextConverter
⌘3
Paste code into fmTextConverter (or in the field press ⌘⌥V)
⌘4
Paste search terms into Search Values field
⌘5
Paste replace terms into replace Values field
⌘7
Convert text in fmTextConverter
⌘8
Copy Result XML to FileMaker Clipboard
⌘V
Paste converted code back into FileMaker

Search Tips

  • Search is case sensitive.
    • Specify both capital and lowercase versions of the search term if you want to replace both!
  • Make your search terms sufficiently specific - or long - to avoid unintentional matches and replacing unintended text.
  • Beware substrings, for example replacing Document then Documents, which can cause unexpected problems
  • Consider XML character encoding when working with XML text.
  • If the terms are too long and lines wrap in the field, it can get difficult to see which search term corresponds to which replace term. In this case use the expand view button < to show larger fields.
Expand View Button Expanded View

Splitting a list of search and replace terms

Have you got your list of search and replace terms as a list of search and replace terms?

No Problem! Just

  1. paste the text into the search field,
  2. choose the delimiter it uses (or click the radio button for tab delimited columns) and
  3. press the Split Search → Replace button:

Two columns

and fmTextConverter will split the text vertically into pairs of search and replace terms

Two columns

And if you want you can use the button again, now titled Merge Search ← Replace, to merge the two columns back together again:

Merge two columns

Problem: Substrings

Beware substrings! If one search term is a substring of another you may end up not getting the results you expect, because the first search term will be replaced before the second one is applied. For example, if you have a search term abc and a search term abcd, then abc will be replaced first, and the result will not contain abcd anymore.

Solution: Sort the lines in decreasing length

fmTextConverter has a very simple solution to this problem: Just press the Sort button to sort the search terms in descending order of length. This way, the longest search terms will be applied first, and you will not have any problems with substrings.

Sort Button

Tip: Pressing the Sort button again returns the records to their original sort order.

Converting FileMaker Code with fmTextConverter

When converting FileMaker Code with fmTextConverter - and thus working with FileMaker XML text - you need to consider a few things

FM → Convert Text → FM

FileMaker objects must, of course, be converted to XML text and back so the text conversion can be applied to the XML.

⌘C
Copy code from FileMaker
⌘⌥V
Paste code into fmTextConverter
Convert text in fmTextConverter
⌘6
Converted text back into FileMaker code
⌘V
Paste converted code back into FileMaker

If the conversion is already defined, use Killer keyboard Mode to repeat the conversion with minimal keystrokes:

⌘C
Copy code from FileMaker
⌘6
FM → Convert Text → FM
⌘V
Paste converted code back into FileMaker

Encoding special XML characters

The following characters are encoded in XML

Character XML
& &amp;
< &lt;
> &gt;
" &quot;
' &apos;

For example, if you want to replace mine & yours with 'mine' and 'yours' in your code, you will need to encode the special characters in both search and replace terms:

Search term
mine &amp; yours
Replace term
&apos;mine&apos; and &apos;yours&apos;

Avoiding breaking the XML

When working with XML text it is possible to break the XML should you accidentally replace text belonging to the XML structure, rather than only the text content you want to convert.

This is seldom a problem, because FileMaker just rejects invalid XML text, and you can just correct your search and replace terms accordingly and try again.

There are several precautions you can take:

Tips:

  • Avoid short search terms, particularly words which are likely to be part of the XML structure, such as id, name, type, value, Field, table etc.
  • When renaming variables, if you include the $ you can’t go wrong.
  • If necessary, add extra terms to avoid or to repair any damage.

Example AT -> LS

Reapplying the Current Conversion

Managing your Text Conversions

Text Conversions can be named, saved and reused later.

Saving your Conversions for Reuse later

You can save your conversions in fmTextConverter for later reuse.

To save a conversion…

  • give the conversion a meaningful title
  • click the pin icon to lock & protect it from accidental deletion.

Add Title here

Important! This only saves the conversion within fmTextConverter, but it does not protect your conversions from being lost during an update of fmWorkMate. For that you must Save your data before updating fmWorkMate!.

Applying an existing Text Conversion

Once you have defined a conversion in fmTextConverter, you can reuse it at any time.

This is very useful, because you often want to apply the same conversion to different things in your FileMaker solution - layout objects, scripts, fields, etc.

List View

  • Switch to the list view by clicking the List button
  • Search for or browse to the conversion you need
  • Click the Edit button to return to the detail view
  • Proceed as above.

Multiple conversions / Killer Keyboard Mode

Once you have set up a conversion in fmTextConverter, if you need to apply the conversion repeatedly to different objects you can use killer keyboard mode to repeat the conversion with very few keystrokes:

In FileMaker
⌘X to cut the old code out
[In fmWorkMate
⌘6 to open fmTextConverter]
In fmTextConverter
⌘6 to convert the code (FM → Convert → FM) from ⌘7 or Ctrl+7 will open the fmTextConverter window.
[In FileMaker (layout objects)
⌘B, ⌘L (the browse-mode-layout-mode dance:) to reset the positioning]
[In FileMaker (script workspace)
to correct the insert point]
In FileMaker
⌘V to paste the new code in

Protecting your conversions against deletions

To protect your conversions against accidental deletion, click the pin icon to turn it into a locked pin icon.

In List View you can delete unprotected records by clicking the bin icon.

  • If there are any unprotected records they will be deleted, no questions asked.
  • If there are only protected records a dialog will appear asking you to confirm the deletion of the selected protected records.

Save your data before updating fmWorkMate!

Warning: fmWorkMate has no update process, so you must save your data before overwriting/updating!

To save your data:

  • Change to List View
  • Find all the records you want to save
  • Press the Export Conversions button to export the records to the desktop.

To restore your data:

  • Change to List View
  • Press the Import Conversions button to import the records from the desktop.

Table of contents