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
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.
04 – Remove empty lines: this option removes any empty lines in your result. Disable this option if you are formatting line items and you need to keep empty records so that the number of line items re
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.