MetaTool > Help > Extraction > Set Field Value

060-670 MetaTool Extraction Edit – Set Field Value

With the MetaTool Set field value rule, you can place data in an index field. You can compare it with a copy command.

It’s often used to run the OCR engine only once and copy the result to different index fields for further modification. In that way, the original OCR text stays intact and only the copied text is manipulated for each index field individually. You typically define an OCR extraction rule first to hold the full text of a scanned document in an index field you call Text Block or Full Text. Next, you would define a Set field value rule to copy the result in an index field for further processing.

The Set field value rule is also useful to set default values and for setting values depending on certain conditions. For example, the CaptureBites Email Export Connector works with index fields to set the subject, email to, email from addresses, etc. All these index fields can be set to a fixed value up front with MetaTool Set field rules. If the values change, you just change the value in the rule and you don’t need to drill down to the Email connector setup. You can even switch to another email address if a certain condition is met.

01 Set field value – Add Rule

Set field value rules are defined in the MetaTool Extract tab.

Press the Add button and select Edit – Set field value to add the rule.

The Set field value Setup window opens.

02 Set field value – Setup

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

From below image samples we want to extract the Account Number, Reference, Date and Category and email the documents using the CaptureBites Email Connector

We want to email these documents to a predefined email address. So we start with a basic Set field value rule making the Email To field equal to mortgage@capturebites.com.
Next, we need to extract the Account Number, Reference, Date and Category. But instead of defining multiple OCR zones, we will read the full text once and duplicate it to the index fields for further processing using Set field value rules.  

After defining an Advanced OCR rule to load the full text in an index field called “Text Block”, we will copy this text in the Account Number index field.

In the Set field value rule, we select the index field to hold the data.

In this case we select the index field “Account Number”.

In the Value field, we place the Text Block index field value which you can simply pick from the Setup menu.

We optionally enter a description.

This rule copies the content of the “Text Block” index field in “Account Number”.

Next we would define a Replace text rule to correct any OCR errors or replace / with -, and Find line and Find word rules to extract the account number. We would follow the same process for the other fields:

We would follow the same process for the other fields: Reference, Date and Category. Because we always start from a copy of the original full text for each of the fields with a Set field rule, any rules to correct or change the data will only apply to that field and will not affect the other index field values.

Next follows an explanation about the more advanced options:

01 – Apply to: here you can choose if you want the value to be set for every document of the batch or only for the first document. In our case, we want it to be set for every document.

An example for applying the rule on only the first document is when you need to enter a handwritten value during manual validation. You could set a default value for the first document only, make this a sticky value in validation and you would only need to enter another value during validation when it changes. It’s like setting the first value of a sequence.

02 – Multi-line mode: Enable the Multi-line mode to apply the Set value rule to every line of text.

For example:
We want to extract the invoice numbers in the third row on the below check and list them in the body of an Email sent to the customer using the CaptureBites Email Export Connector.

Check document with invoice numbers in the third row

 

The result after OCR extraction of the green zones is:

 

We want to add a sequential line item number in front of each invoice number.  To do this, we enable Multi-line mode and add the Line Number value followed by a “)” and a space in front of the multi-line content of the Email Body index value.

The Value Setup will be explained in more detail later.

The final result after this multi-line mode enabled set field rule looks like this:
03 – Condition: here you choose which condition should be applied to execute the rule. The default is no condition, which means that the rule is always applied.
04 – Setup of Condition: after selecting a condition, push the Setup button to setup your condition.

In our example, we want to change the default Email To value, that we pre-set in the beginning of this help page to mortgage@capturebites.com. However, we want to set the email address to the manager’s Email when the Category value is equal to AA.

We select the “If field value is equal to” in the Set field value setup and press Setup next to the condition.

The Condition Setup window opens.

1) If index field: select the index field that needs to be evaluated

2) is equal to/ is not equal to/ is greater than/…: here you type in the value your index field needs to be compared with. By pushing the Setup button, you can also select different system and index values to compose your value. In our example we just type AA

05 – Value: here you enter the value you want to copy in the selected index field. By pushing the Setup button, you can select different system and index values to compose your value. To complete our conditional rule we simply enter the manager’s email address.
The result after executing our rules will look like this:

When the Category is not AA, the email defaults to mortgage@capturebites.com

When the Category is AA, the email changes to manager@capturebites.com
Another common use case for conditions is to set an index field equal to a value if it is blank. For example, if the tax amount on an invoice is blank, then set it to 0. This is important if the data is exported to a database using the CaptureBites Database Export Connector. Many databases do not accept blanks in a numeric field but do accept 0.

Example case: the Tax Amount is erased from the second invoice because the goods are free of tax. In this case, the OCR engine will detect a blank.

The Set field value rule would look like this, when the Tax Amount is not found on the document, the value will become 0:
The results of the first invoice would look like this:
The results of the second invoice would look like this: