MetaServer > Help > Extract > Format Text

120-650 MetaServer Format – Format Text

With MetaServer’s Format Text rule, you can convert text to different formats.

NOTE: a simple trick to determine if data is a number or text, is to ask yourself the question: “Does it make sense to add or subtract the data?”. If the answer is yes, it’s a number, otherwise, it’s text.

For example, codes, like Tax ID numbers, invoice numbers, telephone numbers, etc. are considered text.

Some examples of codes:
– Telephone numbers, with formats like “(408) 993-1900”, 408-993-1900”, “408 993 1900”, “(408) / 993-1900”, “0556/10.20.30” etc.
– VAT numbers, with formats like “BE-0683.808.923”,” BE0683 808 923”, “BE0683808923”, etc.
– Codes consisting of characters and digits like license codes, product codes, etc.

The Format Text rule is useful for formatting text consistently, or to only keep a certain part of your text. It’s frequently combined with Replace Text, Set Field Value or Find Word with Mask / Words rules.

In our example, we will make use of the “CB – INSPECTION REPORTS” workflow. This workflow is automatically installed with CaptureBites MetaServer.

Format Text rules are defined in a MetaServer Extract or Separate Document action.

To add this rule, press the Add button and select Format -> Text

After extracting the license number, we want to convert it to a more readable format by separating the category from the digits with a dash (“-“).

First, add a description to your rule. Then, select a field that holds your text. In this case, we select the field “License Nr.”.

01 – Output format: here you set up the output format of your text. Press the drop-down arrow to select different format types to compose your text. In our case, we want to separate the alphabetic characters (max. 4 characters) from the 5 digits with a “-“.

02 – Alignment: here you can choose if you want to start formatting from the left or right side of the text.

Using this approach, you can add characters or easily extract a certain part of the text.

For example, to extract the area code from a telephone number:
– Output format: { ?, 3 }
– Input value: 408 993 1900
– Alignment: Left
– Result = 408

In our example, choosing the left alignment will result in an incorrect output. It will return the first 4 characters and add a “-“ followed by the remaining 5 characters.

The right alignment returns the last 5 characters (digits) and adds a “-“ followed by the remaining 4 (or less) characters.

03 – Example: enter some text here to test the format rule.

TIP: you can copy the current settings and paste it in another setup window of the same type. Do this by pressing the Settings button in the bottom left of the Setup window and by selecting Copy. Then open another setup window of the same type and select Paste.

After extracting the license number and setting up our Format Text rule, we get the following result: