On any given mark sense zone, just one output per zone can be generated. If only one box is selected, then the hit literal can be returned for that box. If more than one is selected, they would like "M" to be output (for "multiple"). If no marks are selected, they want a null. The mark sense zones are interspaced with regular text zones. Finally, they would like to pipe-delimit the entire form.
Sometimes customers need to dynamically change how mark sense zones output. Since a mark sense zone does not have a ".value" property to modify (it has a hit literal and a miss literal and a ".checked" method), the VB Script will check the mark sense zone, determine the correct output, and write the output to an output zone. Since there are intermixed mark sense and other zones, the Post Verification script is structured so that it rolls through all zones, gathers up all information, and outputs it to the output zone. Delimiting characters must be included in this scenario. All zones except the output zone should have output disabled under Parameters | Output at the Zone Level.
Since the script is creating and inserting the needed delimiters, set the delimiters on the Output Zone to nulls by selecting the delimiters then pressing the Backspace button.
GUI Product Features Used in this Script:
-
Parameters | Output | Output Zone ASCII disabled.
-
Parameters | Output | Row delimiters set to nothing.
Key VB Script Features Demonstrated in this Script:
-
String Concatenation (VB Script)
-
UniqueCheckedBoxOffset (OCR for AnyDoc)
-
.Box Object (OCR for AnyDoc)
Example Script:
iCount = 0
strBlankDelimiter = "||,"
strFrontDelimiter = "|"
strBackDelimiter = "|,"
'Since the script concatenates all output into the last zone, for/next until the next-to-last
For xx = 1 To (Form.ZoneCount - 1)
If Form.Zone(xx).IsOMR Then
iHit = Form.Zone(xx).UniqueCheckedBoxOffset
If iHit <> 0 Then
zOutput.Value = zOutput.Value & strFrontDelimiter & Form.Zone(xx).Box(iHit).HitLiteral & strBackDelimiter
Else
For yy = 1 To Form.Zone(xx).BoxCount
If Form.Zone(xx).Box(yy).Checked Then
iCount = iCount + 1
End If
Next
If iCount = 0 Then
zOutput.Value = zOutput.Value & strBlankDelimiter
Else
zOutput.Value = zOutput.Value & strFrontDelimiter & "M" & strBackDelimiter
EndIf
End If
Else
zOutput.Value = zOutput.Value & strFrontDelimiter & Form.Zone(xx).Value & strBackDelimiter
End If
Next