QAID # 17506 Published
Question / Problem:
Classification Using Bar Codes
Answer / 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
Prior to KTM 5.5, a script reclassification can only occcur one time in Extraction and one time in Validation per Document.
Starting with KTM 5.5, the Reclassify method has been improved as described in the KTM 5.5 Release Notes:
The Reclassify method can now 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.