Decimal separator detection
The Line Item Matching Locator automatically detects the decimal separator from the document data. It also detects the decimal separator for the order positions from the database to enhance the locating and the matching of quantity and prices by the Line Item Matching Locator, especially for documents with ambiguous amounts or quantities like 1,000 or 1.000. Due to a mixture of decimal separators caused by poor recognition, the decimal separator can also be controlled and checked by script. It can be set per document for the document data and the order positions can be retrieved from the database.
If the automatic detection fails for specific vendors, a Script Locator can be used to set the decimal separator for that vendor per document. To check which decimal separator has been used on a document, check the LastDocumentDecimalSeparator(LastDatabaseDecimalSeparator) of the locator in a debugging session. For example, in the Document_AfterExtract event. This will tell you which decimal separator was used for the document when you are in detect mode.
Since there is no need to set the decimal separator for the database per document, you may want to use the Application_InitializeScript event to set the decimal separator for the whole application session if required.
If the detection of a decimal separator fails because there appear to be a mix of decimal separators, this might be caused by poor recognition.
The following sample code shows how to set the decimal separator for a document:
' Add a reference to "Kofax Cascade Line Item Matching Locator" library to your script
Private Sub SetDecimalSeparator(sClassName As String, sLocatorName As String, sDecimalSeparator As String)
Dim pClass As CASCADELib.CscClass
Dim pLocatorDef As CASCADELib.CscLocatorDef
' get the locator definition
Set pClass = Project.ClassByName(sClassName)
Set pLocatorDef = pClass.Locators.ItemByName(sLocatorName)
' convert it to the LineItemMatchingLocator interface
Dim oIExtMethod As CASCADELib.ICscExtractionMethod
Set oIExtMethod = pLocatorDef.LocatorMethod
Dim oILIMLoc As CscLineItemMatchingLocLib.CscLineItemMatchingLocator
Set oILIMLoc = oIExtMethod
Select Case sDecimalSeparator
Case "."
oILIMLoc.DocumentDecimalSeparatorMode = CscDot
Case ","
oILIMLoc.DocumentDecimalSeparatorMode = CscComma
Case Else
oILIMLoc.DocumentDecimalSeparatorMode = CscDetect
End Select
End Sub