Format

Use this function to format a string field and return the result.

Syntax

Format (String, FieldType, Format)

Parameter

Description

String

Enter a valid string of non-formatted text. The default is the current field.

FieldType

Enter the field type indicator you want the system to use to format the first parameter. The default is the current field type.

Format

Enter the field format you want the system to use to format the first parameter. The default is the current field format.

The system applies formatting to a given string. Some field types do not require format strings to accomplish formatting. For example, the X field type indicator automatically uppercases all letters in a string without requiring a format.

Note The variable field must be the same length as the format mask.

Example

Here are some examples:

Function

Result

Explanation

Return(Format

("1234.89", "n", "zzz,zzz.99"))

1,234.89

Formats the field as numeric, by adding a comma and using two decimal positions, as specified in the Format parameter.

Return(Format

("ABCDEF", "C", "3,.123."))

ABC.123.

DEF

Custom formats the field by adding .123. after the third input character.

Return(Format ("222334444", "n", "999-99-9999"))

222-33-4444

Formats the field as a numeric, by adding hyphens as specified in the Format parameter.

See also