How do I remove text formatting from a field? Updated: Dec 03, 2011
Sometimes text within a field has had formatting applied to it (color, bold, font, size, etc.). Formatting applied to text within a field will override field formatting applied to the field as a whole when in layout mode. It's possible to create conflicting formats by creating one format for a field object in Layout mode, and a contrasting format for field data in Browse mode. Here is how FileMaker Pro resolves text formatting conflicts:
When you format a field in Layout mode, the formatting affects only the appearance of that particular occurrence of the field object.
When you format field data in Browse mode, this formatting is stored with the data, and you see it in any layout that displays that field. Field data that is formatted in Browse mode takes precedence over data formatting in Layout mode. For example, if you format field text as Bold in Browse mode, then switch to Layout mode and format the same field as Plain Text, the text will continue to display as bold.
It is often desirable to remove this formatting in order to make the text in the field comply with the field's formatting.
The easiest way to achieve this is to use the TextFormatRemove function.
This removes all text formatting from text in a single action. All fonts, styles, font sizes, and font colors are removed from the specified text.
The following methods show how to implement these functions:
Method 1: Prevent text from being formatted during data entry.
A field can be defined to make sure data is entered in a specific format, or within a certain range. To save time and ensure accuracy, you can set FileMaker Pro to automatically enter unformatted data in a text, number, date, time, and container fields. For example, field.
To set options for automatic data entry:
With the database open, choose File menu > Define > Database.
In the Define Database dialog box, click the Fields tab.
If your database contains more than one table, select the appropriate table from the Table list.
Select your text field from the list of existing fields, or define a new one, for example fieldA.
Click Options (or double-click the field name).
In the Options for Field dialog box, click the Auto-Enter tab and select the Calculated Value (or click Specify), then enter the following calculation.
To make an auto-enter calculation self-modifying, leave the Do not replace existing value for field (if any) option unchecked.
Since Auto-enter calculations can be self-referencing, this will ensure that any data that has been entered will be stripped of any text formatting.
Method 2: Remove existing text formatting using the replace command
You can replace the contents of a field in all records or in a found set with a calculation that also uses the TextFormatRemove function.
Important: This process overwrites a field in every record (or every record in the found set) with a new value. You can't undo replacing field values. Before you begin, consider making a backup copy of the file.
To replace field values in every record in the found set:
If necessary, find, omit, or sort the records in the database file.
In Browse mode, in the current record, select the contents of the field you want to replace, for example fieldA.
Choose Records menu > Replace Field Contents.
In the Replace Field Contents dialog box, select Replace with calculated result, then click Specify.
In the Specify Calculation dialog box, enter the following calculation:
This method is good for changing one field at a time on a given set of records or all records.
The following are alternative methods that will also achieve this:
Method 3: Manually reformat the text
To eliminate formatting applied in Browse mode, manually reformat the text in Browse mode.
Sometimes when there are a small number of fields and records involved, it is simpler to just select the text in question while in Browse mode and change it to the appropriate font, font size, and font style using the selections available from the Format menu (you can turn off multiple styles by using the plain text option). Make sure you select all the text in the entire field or else other layouts may not conform to the changes.
Method 4: Export and Import text
To eliminate formatting applied in Browse mode, export data as text and re-import the data.
This method is useful when multiple fields across multiple records are affected. The process of exporting and importing information as tab or comma separated text will strip a field's contents of its formatting. In order to use this method, find the affected records and export them to a tab separated text file. Then, import those records using the setting 'Replace data in current found set.
Important: Do not change your found set after exporting. Always, backup your database before executing a change like this, in case you make a mistake.
Additional information can be found in the following FileMaker Pro Help topics:
Exporting data from FileMaker Pro
Importing data into an existing file
Other webpages about FMP 12
- FileMaker version comparisons
- FileMaker Knowledgebase Article documenting all of the changes - a great resource!
- FileMaker 12 Whats New from DB Services
- FileMaker 12 Managing Container Data also from DB Services
- New Features Video from Matt Petrowsky of FileMakerMagazine.com
- 12 days of FileMaker 12 series of webinars from FileMaker Academy