In case the Vendor information was not found on the invoice and therefore the Vendor was not extracted and checked against the Data Set, how to assign the correct Vendor using other information from the invoice?
For such cases, the Rule-based Classifier can be used. Please refer to the following steps describing the process:
- The Rule-based Classifier can be developed in FlexiLayout Studio. Please refer to the Online Help for more information on the Rule-based Classifiers.
- For the described method to work, the classes in the classifier should be named in the form of cls<VendorID>.
- In the rules, describe the logic by which the invoices should be classified (ex., by the Carrier Name, etc.).
- After the classifier was created, it should be exported from FlexiLayout Studio.
- In FlexiCapture for Invoices project, create a Classification Batch and load the exported classifier (right-click on a Classification Batch > Properties > Classification > Load). Please note that you don't need to do Class Mapping for this method to work.
- Open the Batch Type Properties (or Project Properties for the Default Batch Type) > Recognition tab. Enable the Classify pages option and choose Use script. Click Set.
- Add the created Classifier Batch to the list of available classifiers.
- Click Edit Script and add the following script.
IBatchTypeClassifierResult result = BatchTypeClassifier.ClassifyPage(Page, true);
//FCTools.ShowMessage("Results are" + result.ClassName, true);
string className = result.ClassName;
//If there is a class, map it to the vendor
if(className.Length > 0)
//set the VendorID to the ID from the found class
What the above method does is:
- When the document is imported, it is classified using the created classifier.
- If it can be classified there will be a resulted class after the classification.
- If there is a resulted class, we assign the predefined parameter fc_Predefined:InvoicePredefinedVendorId the value which should be the Vendor ID.
- In the above method, we named the classes cls<VendorID>, so the resulted class name except the first 3 symbols is used.
- Since the predefined parameter fc_Predefined:InvoicePredefinedVendorId is not blank, the FlexiCapture will use this information to process the invoice. The rest of the Vendor information will be extracted from Data Set. Correct Field Extraction Training Batch will be used.