MetaTool > Help > Extraction > Calculate Number

060-690 MetaTool Extraction Edit – Calculate Number

With the MetaTool Calculate Number rule, you can add, subtract, divide or multiply two values. For example you can calculate a Total before tax or a price after discount.

You typically extract the full text with an OCR extraction rule first. Next, you would find and format the Total on the document and define a Calculate Number rule.

01 Calculate Number – Add Rule

Calculate Number is defined in the MetaTool Extract tab.

Press the Add button and select Edit – Calculate – Number to add the edit rule.

The Calculate Number Setup window opens.

02 Calculate Number – Setup

In our example we will make use of the CB MetaTool Keyword Doc Sep job. This job is automatically installed when you install CaptureBites MetaTool.

We want to calculate the total amount after a 2% discount for early payment. The total amount is located on the last page of the inspection reports.

We first add an Advanced OCR rule for the index field “Full Text Last Page”. Next we find and format the Total Due from each document. Refer to the help pages of the Find word with Mask / Words, Find line with Mask / Words, Find number and Replace text rule for more details.

Finally, we define the Calculate Number rule. We select the index field that will hold the final result, in this case, “Total Due Early Payment”.

Optionally, we enter a description.

03 – Apply to: here you can choose if you want to do the calculation for every document of the batch or only for the first document. In our case, we want it for every document.
04 – Source field: select the source index field that contains a number. In our example this is the index field “Total Due” holding the extracted total amount printed on the last page of the document.
05 – Operation: here you select which function should be applied. You can add, subtract, multiply or divide the numbers. In our case, we multiply the Total Due with 0.98 (= Total Due after a 2% discount) to calculate the Total Due Early Payment, so we select the “*” function.
06 – Value: here you enter the value you want the Source field to be multiplied with. You can also select an index field from the dropdown list holding the value. In our example, we enter 0.98 to calculate the Total Due Early Payment

07 – Decimal symbol: here you enter the decimal symbol used in the Source field value and Value, in our example we use the “.” as decimal symbol.

08 – Digits after decimal: here you enter the required number of digits after the decimal point for the result of your calculation, in our case we want 2 positions.

09 – 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. This option only influences the result if the decimal after the last significant decimal position equals 5.

For example: 10.5545 is always rounded to 10.55 and 10.5565 will always be rounded to 10.56 regardless of the option’s state.

The final result will look like this, the first value being the original Total Due, and the second value the Total Due Early Payment after the 2% discount.

Subscribe to our Newsletter

Please enable JavaScript in your browser to complete this form.

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.