How to Format Field Values Using Input Translation
Using the "Input Translation" event, you can format the data for a particular field as the form is being created or updated. This event is particularly handy for ensuring a consistent data format or naming nomenclature. For example, this event can be used to ensure that all text is translated to uppercase, that extraneous spaces are removed from text, or that a telephone number is formatted with hyphens.
How It Works
The "Input Translation" event is located in the Programmer's pane for most editable fields. This event is not present for computed fields or Rich Text fields. Field translation occurs based on a specified formula when the document is saved or refreshed. Some of the common Formula Language functions used to translate data values include @trim, @UpperCase, @LowerCase, and @ProperCase.
Implementation
To implement this solution, insert a formula in the field's Input Translation event. The following illustrate some of the field translation formulas.
Example 1
The @TRim function removes extraneous leading, trailing, and embedded spaces from the string.
@Trim ( FIELDNAME )
Example 2
The @Uppercase function changes the string to all uppercase.
@UpperCase ( FIELDNAME )
Example 3
The @ProperCase function changes the string such that the first character of each word is capitalized.
@ProperCase ( FIELDNAME )
Example 4
The @LowerCase function changes the string to all lowercase letters.
@LowerCase ( FIELDNAME )
Tip
If you're looking for additional Input Translation samples, check out the Lotus Notes discussion forums at http://www-10.lotus.com/ldd/46dom.nsf/ or http://www-10.lotus.com/ldd/nd6forum.nsf. For example, if you're looking to format a telephone number, you could search these databases. A good example can be found in the 46dom.nsf database. Simply search for "Validation Code for a Phone Number field" or "Phone Number". Be sure to include quotes to narrow down the results.