Define and Edit Data Validation Lists
SmartZone ICR/OCR allow you to provide a list of expected data contents. If you know potential actual values, providing that information will make your recognition results more accurate.
//Clear previous DVL
smartZoneICR1.Reader.DataValidationListClear();
//Add new ones
for (int i = 0; i < checkedListBoxDVL.Items.Count; i++) {
object curritem = checkedListBoxDVL.Items[i];
if (checkedListBoxDVL.CheckedItems.Contains(curritem))
{
smartZoneICR1.Reader.DataValidationListAddEntry(curritem.ToString());
}
}
//Clear previous DVL
smartZoneOCR1.Reader.DataValidationListClear();
//Add new ones
for (int i = 0; i < checkedListBoxDVL.Items.Count; i++) {
object curritem = checkedListBoxDVL.Items[i];
if (checkedListBoxDVL.CheckedItems.Contains(curritem))
{
smartZoneOCR1.Reader.DataValidationListAddEntry(curritem.ToString());
}
}
Using a Data Validation list provides additional feedback on recognition by way of the returned FieldType value. For example, a regular string will return a FieldType of GeneralText.
- When a DataValidation list is used, if the recognized value matches a value in the list, the FieldType of DataValidationList is returned.
- Otherwise, the FieldType of Unknown is returned, indicating that the recognized value was not in the list.
Practical Uses of Data Validation Lists
- Well known values from a static list.
For example, a list of state abbreviations:
var stateList = new List<String>() { "AL", "AK", "AZ" ... };
- Dynamically set items based on the value of another field.
For example, if the Area code for a phone number was 703, the corresponding State could be validated against VA and DC; it should be one of those values.
- Dynamically set items based on program conditions.
For example, your program could be in a state where the only acceptable values in a field would be "N2101", "N2102" or "N2117."
Case Sensitivity
When comparing list entries and recognized text, the Data Validation engine assumes both are words with standard capitalization.
Scenarios with Mixed Cased List Entries and Recognized Text
Refer to the following behaviors for scenarios with mixed cased list entries and recognized text:
- Recognized text whose first letter is uppercase will match list entries whose first letter is uppercase or lowercase.
Example: Recognized text "Sat'' will match a list entry of “Sat” or "sat".
- The inverse is not true.
Example: Recognized text "sat'' will not match a list entry of "Sat".
- Recognized text with all uppercase letters will match list entries with the same characters, regardless of upper or lowercase.
Example: Recognized text of "SAT" will match a list entry of "Sat", "sat" or "saT"
- Recognized text whose characters are mixed case after the first character will only match list entries that are exactly the same.
Example: Recognized text of "sAT" will only match with "sAT". Recognized text of "SaT" will only match with "SaT".