Symptoms
A FlexiCapture document definition can use rules to validate or manipulate data, including AutoCorrect scripts on fields.
If a field is hidden from view in the Verification screen then a message stating "The document has hidden fields, some of which have errors".
Cause
FlexiCapture rules belong to fields; if the field is hidden there is no way for a user to interact with that field data which can make resolution impossible.
Resolution
By adding an event handler to the FlexiCapture project, or batch type, the errors can at least be exposed in a way that's visible to the user.
A basic solution is documented via the ABBYY Knowledgebase and a refined version of the same is below.
The code below can be added the 'After document state changed' event handler.
The event handler is found in Project Properties > Event Handler > After document state changed if default batch type is used, or Batch Type Properties > Event Handler > After document state changed when a custom batch type has been defined.
using System; using System.Collections.Generic; foreach (IRuleError ruleError in Document.RuleErrors) { FCTools.ShowMessage(string.Format("{0} [{1} -> {2}] {3}", ruleError.IsWarning ? "WARN" : "ERROR", ruleError.RuleName, ruleError.GetFields()[0].FullName, ruleError.Message)); List<string> messages = new List<string>(); foreach (IField f in ruleError.GetFields()) { messages.Add(string.Format("\t{0}: {1}", f.IsVisible ? "V" : "H", f.FullName)); } messages.Sort(); // Hidden fields displayed first messages.Where(p => p.StartsWith("H")).ForEach(p => FCTools.ShowMessage(p)); // This line shows only the hidden fields messages.ForEach(p => FCTools.ShowMessage(p)); // This line shows all fields }
The processing log for the document will then show an output similar to below with each rule error clearly stating the error type (WARN/ERROR), the name of the rule -> the 'primary' field for the rule, and then a list of all fields involved in the rule with H/V to indicate if the field is hidden or visible.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article