Add formatting to a text field
You can specify formatting rules for text fields. If the configured conditions are true when a user fills in a field value, then the formatting is applied. Formatting rules can be used to:
- Change case
- Insert a prefix
- Append a suffix
- Insert characters
- Remove characters
- Replace characters
Formatting rules are created on the Formatting tab of the Additional Properties pane.
Example: You have a PO system and want to insert PO- prior to purchase order numbers that users enter. You can set up a formatting rule for the data field to look for the first few characters in a PO number and automatically insert the PO- as a prefix to those values.
Add a formatting rule
Click Add Formatting.
Enter a name for the formatting rule in the Name box.
Select an option from the If the value drop-down box. The following options are available:
- Starts With: The value starts with the characters entered in the box.
- Ends With: The value ends with the characters entered in the box.
- Contains: The value contains the characters entered in the box.
- Matches Regex: The value matches the Regex entered in the box.
- Length: The value is a particular length of characters. Select an operator from the drop-down menu, then enter a character length in the box.
Select the Ignore Case check box to ignore the case of entered values.
Select an option from the Then drop-down box. These will be applied to the entered value when the If the value condition above is met. The following options are available:
Change Case To: Changes the case to either uppercase or lowercase.
Prefix With: Adds text to the beginning of the value.
Suffix With: Adds text to the end of the value.
Insert: Inserts text within the value. Specify where text should be entered in the At position box. Specify a length in the Until the length box. The text will be repeated in the position until the length is met.
Remove: Removes the specified number of characters. Specify where characters should be removed in the At position box. Specify a length in the Until the length box. Characters will be removed from the position until the length is met.
Replace: Replaces part of the entered value with new text. Specify the text you want to replace in the box, then enter the new text in the With box.
- Select Stop processing further formatting to stop processing subsequent formatting rules once a rule has been applied.
- Click Add Formatting to add additional formatting rules if necessary.
You can see how the current set of formatting rules will be applied to an entered value.
- Click Test.
In the Data Field Formatting Test window, enter a value then click Apply Formatting.
You will be able to view the status and output for each rule and the final formatted value.
Click Close to return to the rule configuration.