From the Verification Station it is possible to select an "Unknown" document and manually match it to a document definition. Is it possible to do this via a document script (within an advanced workflow)? I've looked through the FlexiCapture 10 help (specifically the IDocument methods) and don't see anything that would accomplish this.
How "manually match" a document definition via script
Was this article helpful?
0 out of 0 found this helpful
Comments
3 comments
For example, here is a real support case. Client had 5 document definitions. First 4 of them had 1 instance of single-page fixed section (for processing of fixed form ) and 1 instance of single-page flexi section. Last document definition had only an instance of flexi section. The point is that all 5 flexi sections had the same flexi layout inside. So, if a batch of documents would be recognized in a usual way, the man would have a lot of assembling errors since flexi section for unstructured pages would be chosen in unpredictable way. The only way to understand which flexi section should be chosen is to know which fixed section was matched on previous page.
In the project we created a batch processing script stage and placed it just before recognition, when all documents are disassembled (so, each page is considered a document). Code of the script was the following ( C# ):
//================
IPageClassificationResult[] Results = new IPageClassificationResult[ Documents.Count ];
string[] DocDefNames = new string[ Documents.Count ];
bool[] IsFixedFormPage = new bool[ Documents.Count ];
for ( int i = 0; i < documents.count;="" i++="" )="">
Results[ i ] = FCTools.ClassifyPage( Documents[ i ].Pages[ 0 ], System.Type.Missing, false );
string sSuitableSections = Results[ i ].MatchedSections;
DocDefNames[ i ] = sSuitableSections.Substring( 0, sSuitableSections.IndexOf( @"\" ) );
IsFixedFormPage[ i ] = (int)Results[ i ].PageType == 2;
}
for ( int i = 0; i < documents.count;="" i++="" )="">
string sCorrectSection;
if ( IsFixedFormPage[ i ] ) {
sCorrectSection = Results[ i ].MatchedSections;
}
else {
if ( ( i == 0 ) || ( IsFixedFormPage[ i - 1] == false ) ) {
sCorrectSection = @"Definizione documento5\Sezione documento 1";
}
else {
sCorrectSection = DocDefNames[ i - 1 ] + @"\Sezione documento 1" ;
}
}
Documents[ i ].Properties.Set( "CorrectSection", sCorrectSection );
}
//================
And code of the handler was just
//==============
if ( Document.Properties.Has( "CorrectSection" ) ) {
Matching.DefinitionsList = Document.Properties.Get( "CorrectSection" );
}
//==============
This script just demonstrates the idea, this is not a kind of “best practice” etc.
Please sign in to leave a comment.