MetaServer > Help > Extract > Format Number

120-640 MetaServer Format – Format Number

With MetaServer’s Format Number rule, you can convert numbers 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.

Numbers can be things like a total amount, number of pages, number of days or a quantity, etc.

Things like a customer number, patient number, invoice number etc. are not numbers, they are text.

Some example number formats:
– Currency format: “$2,265.00”, “£ 2265.00”, “2265,00 €”, “2.265,00 CHF” etc.
– Depending on your region, you can set a specific decimal symbol, the number of digits after the decimal or define the thousand grouping symbol, like “10256”, “10 256”, 10.256”, “10,256”, “10.256,00”, “10,256.00”, etc.

The Format Number rule can be useful for formatting your numbers consistently and for filtering your text, so you only keep valid numbers. It’s frequently combined with Replace Text, Find Word with Mask / Words or Find Line with Line Number rules.

Format rules are also useful after a Validation action to minimize key strokes and standardize the final output format. For example, you allow the user to type 100 and then apply a format rule to automatically convert the manually entered amount to 100.00

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

Format Number rules are defined in a MetaServer Extract or Separate Document / Process Page action.

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

After extracting the Total Due, we want to change its format and remove the currency symbol and thousand separators. We also want to consistently output the Total due using “.” as a decimal symbol, and have two decimals after the decimal symbol.

TIP: The thumbnail on the right will follow you, so you can easily refer to the Setup window. Click on the thumbnail to make the image larger.

First, add a description to your rule. Then, select a field that holds the number value. In this case, we select the field “Total Due”.

01 – Input format: enable this option to automatically convert “.” and “,” decimal symbols to the specified decimal symbol in the Output format. If disabled, the decimal symbol defined in the output format is used.

NOTE: If you plan to update an external database with a number value, avoid using currency symbols and thousand seperators. Database systems expect basic number formats without any thousand separators or currency symbols.

For example, use 1000000.00 instead of  $1,000,000.00.

01 – Currency: choose this option if you want to retain or add a currency symbol to your number. To open the currency setup window, press the Setup button.

The Currency Format window opens…

1) Symbol: specify the currency symbol of your number. If you want to detach the currency symbol from the amount, add a space in front or after the symbol.

2) Decimal symbol: specify the decimal symbol of your number.

3) Digits after decimal: specify the number of digits after the decimal. If you don’t want a decimal symbol and digits after the decimal, make the decimal symbol blank and enter 0 as the number of digits after decimal. For example, “$2,265.00” will become “$2,265″.

4) Digit grouping symbol: specify the digits grouping symbol of your number.

5) Positive / Negative format: press the drop-down arrow to select the position of the currency symbol. You can define this independently for negative and positive numbers.

02 – Number: choose this option if you don’t want a currency symbol in your number.

1) Decimal symbol: specify the decimal symbol of your number.

2) Digits after decimal: specify the number of digits after the decimal. If you don’t want a decimal symbol and digits after the decimal, make the decimal symbol blank and enter 0 as the number of digits after decimal. For example, “$2,265.00” will become “$2,265″.

3) Digit grouping symbol: specify the digits grouping symbol of your number. In our case, we don’t want a digit grouping symbol, so we leave it blank.

4) Add leading zeros: enable this option to add leading zeros to your number. You can specify the total number of digits before the decimal. For example, if the number of digits before the decimal symbol is 8, then the value “12” will become “00000012”.

03 – Example: here you can enter a number to test the format.

When you enter an invalid number in the example, the preview will show “Error”.

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.

After extracting our Total Due and setting up the Format Number rule, we get the following result:

Before

After

Subscribe to our Newsletter


Please check the box below to agree to the privacy policy and continue *


NOTE: if you're experiencing trouble with submitting this form, please try again using another browser.