Setting 'fc_Predefined:InvoicePredefinedVendorId' a script in a document definition

  • 373 Views
  • Last Post 15 August 2016
richfish posted this 14 July 2016

Hi Everyone,

I have a requirement to set registration parameter 'fc_Predefined:InvoicePredefinedVendorId' via a script in Flexicapture for Invoices.

I have two Document Definitions setup, one based on a custom flexilayout that identifies the correct supplier ID. In this instance I cannot use the built in supplier matching within the invoice recognition document definition. I'd like to pass the Supplier ID from this document definition to the main invoice recognition definition using registration parameter 'fc_Predefined:InvoicePredefinedVendorId'. I understand the best way of doing this will be to create an advanced workflow with the two recognition steps and passing the Supplier ID between the two. (I know this will result in x 2 page count but this is acceptable).

I have ruled out other options such as setting a parameter at point of scan, adding the required supplier details to the local dataset ect.

Can anyone explain the process of setting the parameter 'fc_Predefined:InvoicePredefinedVendorId' via a vbscript or C# .net script and also the method of passing this to the next document definition please?

Many thanks

Richard

Vladislav Suvorov posted this 15 August 2016

Hello,

The usage of registration parameter seems to be the following in your case(advanced workflow):
1)Recognition stage 1 - First Document Definition is being matched(use before matching Event handler to specify which Document Definitions can be matched. If you are unfamiliar with it please use Help > Appendix > Using scripts in ABBYY FlexiCapture > Scripts for customizing processing stages > Types of scripts > Event handlers > Before matching):
if (Document.Properties.Get("Stage")==x) /*likely you would like to check if document has fc_Predefined:InvoicePredefinedVendorId already set or not to determine which Document Definition should be used*/
{
for (int i=0; i
{
Matching.NeedRecognition=true;
Matching.DefinitionsList="DefinitionName1";
}
}
2)Cleaning Recognition Results - Custom stage that creates and sets fc_Predefined:InvoicePredefinedVendorId to desired value(probably needs to be linked to previous stage):
Document.Properties.Set("fc_Predefined:InvoicePredefinedVendorId", Fields.("SupplierID").Value);,
also clear recognition results if needed(registration parameters will persist through it):
for (int i=0; i
{
Batch.CleanRecognitionResults(Batch.Documents);
}
and split(if you want to split please see MovePage method in Help for this).
3)Recognition stage 2 - Second Document Definition is being matched and it will use mentioned Registration Parameter automatically. Clarification: you need to create second recognition stage which has a specific list of Document Definitions to match(before matching Event handler:
if (Document.Properties.Get("Stage")==y)
{
for (int i=0; i
{
Matching.NeedRecognition=true;
Matching.DefinitionsList="DefinitionName2";
}
}).

Multiple operations of the same type with one page inside one workflow cycle won't result in double pages count in license.
Sorry for the long and complicated response.

Regards,
Vladislav

Close