Scripting - Classification Using Bar Codes
Article # 3037092 - Page views: 74
Issue
Classification Using Bar Codes
Solution
If you want to use a bar code for classification:
- Create a bar code locator on project level. (Locators on project level will be executed before any classification takes place.)
- Create a field on project level (e.g., named "Barcode").
- Connect the field with the locator.
- Add the following code to the project script:
Private Sub Document_BeforeClassifyXDoc(pXDoc As CASCADELib.CscXDocument, _ bSkip As Boolean) Dim BarcodeText As String BarcodeText = pXDoc.Fields.ItemByName("Barcode").Text If BarcodeText = "12345" Then pXDoc.Reclassify("Form12345") ElseIf BarcodeText = "67890" Then pXDoc.Reclassify("Form67890") Else ' continue with normal classification End If End Sub
The Reclassify method can be called several times during processing in order to classify a Document to a different class and perform the extraction again. Note that to avoid endless loops, the use of the Reclassify method is limited; it can be called once per classification step and up to 100 times per extraction step.
In addition, the event has a new optional parameter, Confidence, that is used to set the confidence value for the Document after reclassification.
Level of Complexity
High
Applies to
Product | Version | Build | Environment | Hardware |
---|---|---|---|---|
KTM | 6.3, 6.4 | All | All | None |