MetaServer > Help > Extract > Calculate Number

# 120-510 MetaServer Edit – Calculate Number

With MetaServer’s Calculate Number rule, you can add, subtract, divide or multiply two numeric values.

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.

The Calculate Number rule can be useful for calculating values like a Total before tax or a price after discount.

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

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

To add this rule, press the Add button and select Edit -> Calculate -> Number.

After extracting and formatting the Total Due (the amount should be formatted without thousand separators), we want to determine the Total Due EPD (The Total Due after Early Payment Discount). The EPD is 2% from the Total Due, so we can calculate this using a Calculate Number rule.

First, add a description to your rule. Then, select the Target field that will hold the calculated value. In this case, we select the field “Total Due EPD”.

01 – Decimal symbol: specify the decimal symbol of your target field value.

02 – Digits after decimal: specify the number of digits after the decimal for your target field value. 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, “2265.00” will become “2265”.

1) Round down: enable this option to round a value like “10.5555” to “10.55”. When disabled, the values are rounded up, so “10.5555” will become “10.56”.

NOTE: This option only influences the result if the decimal after the last significant decimal position equals 5.

For example:

10.5545 will always be rounded to 10.55.

10.5565 will always be rounded to 10.56, regardless of the option’s state.

03 – Field: select a field that holds a numeric value, formatted without thousand separators. In this case, we select the field “Total Due”.

04 – Operation: press the dropdown button to select which function you want to apply. You can add, subtract, multiply or divide the numbers. In our case, we want to apply a 2% discount on the Total Due. To do this, we multiply the Total Value with 0.98, so we select the “*” function.

05 – Value: select the field containing the numeric value that should be added, subtracted, multiplied or divided with the target field. You can also manually enter a numeric value. In our case, we multiply the target field with 0.98.

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 and formatting the Total Due
• Calculating the Total Due EPD by multiplying the Total Due with 0.98 with a Calculate Number rule

we get the following result: