×
Menu
Index

3.3.28. Checkbox Detection with Data Grids

3.3.28. Checkbox Detection with Data Grids
 
Checkbox detection can be included on your Job by using OCR Zones or Data Grids.
On this article we will learn how to implement checkbox detection using a Data Grid.
 
The first step is to enable a Grid Control on the Panels Toolbar on the Administration Tab:
Enabling Grid Control 1 for checkbox detection.
 
The Grid Control must be setup with at least two Data Fields. On the image above we have the fields "Checkboxes" and "Document".
 
The second step is to create the Grid on the document and create position triggers if needed as referred in the image below:
Two instances of Grid Control 1 were created to capture all of the desired checkboxes. The Checkbox field will be used to capture the checkboxes and the Document field will be used to capture the document name.
 
Finally, Advanced OCR Reading must be enabled for the column capturing the checkboxes and the Mark Detection Engine should be selected,
please refer to the images below:
Make sure that Advanced OCR Read is turned on for the column that will be capturing the checkboxes.
Make sure the columns that are capturing the checkboxes are using the MarkDetection OCR Engine and that the Adjust filter is set to OFF.
 
The Mark Detection Engine can be set to Threshold Level or Entity Count. Both need a good sample size to provide always accurate results.
Learn more about the Mark Detection Engine here.
 
The Data capture by the Grid can be exported by enabling the Grid Control Module exports on your XML or TXT export module.
The data can also be further processed before exporting by using a VBScript.
Below you can see a few example scripts:
 
Horizontal Table (fixed values based on row number)
'Grid Control Number
tableNumber = 4
'Get number of rows for current grid
NumRows = ChronoDocument.GetXgridRowCount(tableNumber)
 
'Create fixed value array
Dim monthArr
 
monthArr = Array("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12")
'Loop through all rows and search for "true" value
For n = 0 To MNumRows   
MValue = ChronoDocument.GetXgridFieldValue(tableNumber,n,"Box")
If MValue = "true" Then
'Set desired actions when the check is found
UserField_Month.value = ChronoDocument.GetXGridFieldValue(tableNumber,n,"Month")
Else
End If
Next
Vertical Grid
'Grid Control Number
Dim tableNumber
tableNumber=1 'we are using table 1
'Grid Row COunt
Dim numRows
numRows=ChronoDocument.GetXgridRowCount(tableNumber)
 
'Loop through each column
For col = 1 To 13
  
    numTrues=0
    For row = 0 To numRows-1
'check for cells set to "true"
        fValue = ChronoDocument.GetXgridColumnValue(tableNumber, row, col)
        if fValue="true" Then
           Call ChronoDocument.set_field_value( "Answer "&col, )
           numTrues=numTrues+1
        End If
    Next
 
    'Check if there is no check or there are more than one check per column
    If numTrues > 1 Then
        Call ChronoDocument.set_field_value( "Ushtrimi "&col, "More than 1 true")
    ElseIf numTrues < 1 Then
        Call ChronoDocument.set_field_value( "Ushtrimi "&col, "No answer")
    Else
    End If
 
Next