Community

Can we do duplicate check in FC11 Answered

Hi,

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???

Was this article helpful?

2 out of 2 found this helpful

Comments

12 comments

  • Avatar
    Sunil

    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.

    Screenshot

    1
  • Avatar
    Ekaterina

    Hello,

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

    0
  • Avatar
    Sunil

    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.

    0
  • Avatar
    Ekaterina

    Hello,

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

    0
  • Avatar
    Sunil

    Is there any sample code for that??

    0
  • Avatar
    Ekaterina

    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.

    0
  • Avatar
    Vladimir Dimitrijević Avaltek.com

    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

    0
  • Avatar

    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;

     

    try

    {

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

        {

            oSqlConnection.Open();

     

            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)

    {

        FCTools.ShowMessage(oException.ToString());

    }


    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");

    }

    else

    {

        Result.CheckSucceeded = false;

    }

     

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

    Best regards,
    Vladimir

    0
  • Avatar

    Hi,

    To add external assembly, refer to this link: http://help.abbyy.com/en-us/flexicapture/12/developer/user_assembly

    Best regards,
    Vladimir

    0
  • Avatar
    NAGESHWAR PORLA

    Hi Team

    Please help me, I am getting issue when I am using the above code.

    See screenshot. 

    https://drive.google.com/file/d/13Q69qv45S6fIN3IcMqa9Eg6znwbtbhuE/view

    0
  • Avatar
    Tony Connell

    Sunil,

    I am glad to see the community is assisting with your question.

    However, your organization really needs to upgrade to FlexiCapture 12.  You are a full dot release behind.   The latest release can always be seen here:

    https://www.abbyy.com/flexicapture-downloads/distributed-invoices/ 

    FlexiCapture 11 is already at End of Sales and will be End of Support early next year:

    https://support.abbyy.com/hc/en-us/articles/360018776140 

    Thanks,

    Tony Connell

    0
  • Avatar
    NAGESHWAR PORLA

    Hi Tony,

    Good Morning.

    we are in FlexiCapture 12.Looking same requirement, we are facing right now in our instance. Users need to verify the Duplicate invoice at Batch processing level it self.

    0

Please sign in to leave a comment.