Can we do duplicate check in FC11

  • Last Post 19 January 2018
  • Topic Is Solved
Sunil Edupuganti posted this 10 December 2017


I want to do the duplicate check in FC11 based upon any of the fields like Invoice Number, Invoice Date, PO Number..

If the same Invoice enters the project setup station, it should not be processed..Is it possible to do the duplicate check in FC11???

  • Liked by
  • Ondrej
  • Vladimir Dimitrijevic
Order By: Standard | Newest | Votes
Ekaterina posted this 12 December 2017


Do you mean “double verification” or do you mean “checking on the database»? Could you please describe your scenario in more details?

Sunil Edupuganti posted this 12 December 2017

Should check with the database, after recognition. If it is duplicate then it should not be processed or else should go to some other folder. If it is not duplicate then it should come to actual workflow.

Ekaterina posted this 13 December 2017


Yes, it is possible. You may create the script stage after recognition and make a database check on it to exclude unnecessary documents

Sunil Edupuganti posted this 13 December 2017

Is there any sample code for that??

Ekaterina posted this 14 December 2017

Please look at the following article in the ABBYY knowledge base
Advanced Workflow
It explains how the Advanced Workflow may be set up and contains useful links and code samples.
The DB checks may be made using any appropriate .NET methods inside the code of the Script (automatic) stage.

Vladimir Dimitrijevic posted this 24 December 2017

Hi Sunil,

As written in private messages, you have done checking duplicate against database, and now you want to skip Verification and route duplicate document directly to Processed.. We should continue here so someone can add better solution... 

Maybe exporting after checking in database is wrong. What if invoice is not a duplicate, if one number was recognized wrong? Also, best practice is to insert every document into database, but with different StatusId= 1,2, 3... (1 = Processing, 2 = Duplicate, 3 = processed, 4 = Exported to SAP...). 

Easiest solution is to add Registration Parameter after you recognize it as duplicate document, like:

Document.Properties.Add("Duplicate", "true");

Make entry condition in Verification stage, add a script to entry rule like:

string duplicate = Document.Properties.Get("Duplicate");

if( duplicate == "true"){

Context.ChecSucceeded = false;


Sorry if there is a mistake in code, I have no ABBYY FC with me... Hope entry condition will solve your issue.


Best regards,

Vladimir Dimitrijevic posted this 18 January 2018

Hello Sunil,

As we had a talk in PM, I will give you some guidelines what you should do to avoid Verification of duplicate invoices.

Add automatic stage, add script for Document processing:

using System;

using System.Data;

using System.Data.SqlClient;


string invoiceNumber = Document.Field(@"Invoice Layout\InvoiceNumber").Text;

string vendorId = Document.Field(@"Invoice Layout\Vendor\VendorId").Text;




    using (SqlConnection oSqlConnection = new SqlConnection("Password=YourPassword;Persist Security Info=True;User ID=YourUserName;Initial Catalog=YourDatabase;MultipleActiveResultSets=true;Data Source=YourSqlServer"))




        string strSql = "SELECT Count([DocumentId]) FROM [YourDatabase].[dbo].[Documents] where InvoiceNumber = @InvoiceNumber and VendorId = @VendorId";


        using (SqlCommand oSqlCommand = new SqlCommand(strSql, oSqlConnection))


            oSqlCommand.Parameters.AddWithValue("@InvoiceNumber", invoiceNumber);

            oSqlCommand.Parameters.AddWithValue("@VendorId", vendorId);


            int count = Convert.ToInt32(oSqlCommand.ExecuteScalar());


            if (count > 0) //this is duplicate

                Document.Properties.Set("Duplicate", "True");

            else //no duplicate

                Document.Properties.Set("Duplicate", "False");




catch (System.Exception oException)




Afterwards add Entry condition on Verification stage:

if (Document.Properties.Has("Duplicate") && Document.Properties.Get("Duplicate") == "False")


    Result.CheckSucceeded = true;

    FCTools.ShowMessage("Document is not duplicate");




    Result.CheckSucceeded = false;



With this entry condition, you will not allow duplicate documents in the Verification stage.

Best regards,

Sunil Edupuganti posted this 19 January 2018

Hi Vladimir,

Thank you very much for your help. I tried with the code which you have given to me. Getting a small problem with the namespace. Could you please check the screenshot once.


Vladimir Dimitrijevic posted this 19 January 2018


To add external assembly, refer to this link:

Best regards,