Hi, I have the following scenario:
Documents to be scanned (sold Fishing Licenses) are received in groups from various vendors, with attached Sales Report. We scan the Sales Report as a "Batch Header" and all associated Licenses into individual batches. The Batch Header document contains 3 data fields which must be entered on each subsequent License document during Verification (data entry).
On the License document definition I've added fields to accept the Batch Header data, and attempted to script (C#.net) copying a value from a Batch Document field. I tried scripting a Rule; then tried a Recognition script; then tried a Custom Action; all attempts have failed. The Rule and Custom Action script produce the attached error message (see image):
System.Runtime.InteropServices.COMException (0x80004005): Cannot access other documents from rule check script.
at ABBYY.FlexiCature.IBatch.get_Documents()
at Main.Execute(IRuleContext Context)
The script (Rule and Custom Action) follows below... the idea is to:
1) get the field's Document (thisDoc)
2) get the document's batch (batch)
3) get the batch's Documents (batchDocs)
4) get the first document in batchDocs (batchHeader)
5) get the text value of a field in batchHeader (batchVendor)
6) assign the batchVendor value to a field: thisDoc.Field("DocVendor")
using System.Diagnostics;
//if (!Debugger.IsAttached)
//{
// Debugger.Launch();
//}
//Debugger.Break();
IDocument thisDoc = Context.Document;
IBatch batch = thisDoc.Batch;
IDocuments batchDocs = batch.Documents;
IDocument batchHeader = batchDocs[0];
string batchVendor = batchHeader.Field("VendorNumber").Text;
Context.Field("DocVendor").Text = batchVendor;
The error message seems to indicate the failure is at the point where it tries to get the batch's collection of Documents...
Anybody successfully done something like this? Is it possible? The support vendor is telling me he doesn't think it will work this way, but we might figure out a workaround hack. My question(s): does the concept above make sense? Shouldn't it work? Am I missing something, can I make it work?
Thanks,
Woody
Documents to be scanned (sold Fishing Licenses) are received in groups from various vendors, with attached Sales Report. We scan the Sales Report as a "Batch Header" and all associated Licenses into individual batches. The Batch Header document contains 3 data fields which must be entered on each subsequent License document during Verification (data entry).
On the License document definition I've added fields to accept the Batch Header data, and attempted to script (C#.net) copying a value from a Batch Document field. I tried scripting a Rule; then tried a Recognition script; then tried a Custom Action; all attempts have failed. The Rule and Custom Action script produce the attached error message (see image):
System.Runtime.InteropServices.COMException (0x80004005): Cannot access other documents from rule check script.
at ABBYY.FlexiCature.IBatch.get_Documents()
at Main.Execute(IRuleContext Context)
The script (Rule and Custom Action) follows below... the idea is to:
1) get the field's Document (thisDoc)
2) get the document's batch (batch)
3) get the batch's Documents (batchDocs)
4) get the first document in batchDocs (batchHeader)
5) get the text value of a field in batchHeader (batchVendor)
6) assign the batchVendor value to a field: thisDoc.Field("DocVendor")
using System.Diagnostics;
//if (!Debugger.IsAttached)
//{
// Debugger.Launch();
//}
//Debugger.Break();
IDocument thisDoc = Context.Document;
IBatch batch = thisDoc.Batch;
IDocuments batchDocs = batch.Documents;
IDocument batchHeader = batchDocs[0];
string batchVendor = batchHeader.Field("VendorNumber").Text;
Context.Field("DocVendor").Text = batchVendor;
The error message seems to indicate the failure is at the point where it tries to get the batch's collection of Documents...
Anybody successfully done something like this? Is it possible? The support vendor is telling me he doesn't think it will work this way, but we might figure out a workaround hack. My question(s): does the concept above make sense? Shouldn't it work? Am I missing something, can I make it work?
Thanks,
Woody