Question
How to determine the Field with the corresponding error: "The document has hidden fields, some of which have warnings" in the document definition.
Answer
Add the following code to the Project Properties > Event Handler > After document state changed if default batch type is used or Batch Type Properties > Event Handler > After document state changed if some custom batch type is used:
string sErrors = "";
foreach (IRuleError ruleError in Document.RuleErrors)
{
foreach (IField f in ruleError.GetFields())
sErrors += f.FullName.ToString() + " ";
sErrors += " : " + ruleError.Message;
FCTools.ShowMessage(sErrors);
sErrors = "";
}
After that:
- In the Project Setup Station, create a batch of the required batch type.
- Load a document there and recognize it.
- Expand the recognition task log.
- There will be messages listing all errors and warnings for all fields (including hidden ones):
Comments
2 comments
Umesh Chandra
Project Properties > Event Handler > After document state changed
Script is disabled for below:
Jeremy Burgess
Suggested refinement to the script. The output is easier to understand with each rule error showing only once and then all associated fields listed below that, indicating which are hidden or visible.
Please sign in to leave a comment.