Community

Can we export data to multiple table

Hi
Can we export data to multiple table and map tabled directly with Abbyy Flexicapture 11 ?

Was this article helpful?

0 out of 0 found this helpful

Comments

5 comments

  • Avatar
    Permanently deleted user
    Abbyy Flexicapture 11 and DB is SQL SERVER 2012
    0
  • Avatar
    Permanently deleted user
    Hello,

    You can either try creating multiple export settings in document definition for each table, or create a custom export script.

    Regards
    Timur



    0
  • Avatar
    Permanently deleted user
    Hi Timur,
    Many thanks for your kind reply. Can u please share some export script in C# ?

    kind regards
    ibrar shah
    0
  • Avatar
    Permanently deleted user
    Hello,

    Heres is an example of a custom export to database

    using System.Data;
    using System.Data.OleDb;
    string ConnectionString = connectionString;
    OleDbConnection Con = new OleDbConnection(ConnectionString); \\-> connection string to your database
    try
    {
    \\-fields you want export
    string ID = Document.Properties.Get("ID");
    string NUM = Document.Field("Document defintion name\\NUM").Text;

    \\open conncetion to DB
    Con.Open();

    using (OleDbCommand cmd = Con.CreateCommand())
    {
    \\insert query
    cmd.CommandText = string.Format("INSERT INTO SomeDBTable (ID,NUM) VALUES" +
    "(?,?)");

    \\insert values to query
    cmd.Parameters.AddWithValue("@ID", ID);
    cmd.Parameters.AddWithValue("@NUM", NUM);

    \\execute command
    int rows = cmd.ExecuteNonQuery();

    Processing.ReportMessage("Export successfull, RowsCount=" + rows);
    }
    }
    catch (Exception e)
    {
    Processing.ReportError(e.ToString());
    }
    finally
    {
    Con.Close();
    }

    This is just an example and it needs to be adjusted according to your needs.
    You can also consider using ODBC connection or System.Data.SqlClient instead of Oledb connection.

    And also, you will need to add an additional insert query in order to add data to multiple tables.

    Since you need to perform two queries, best practice is to execute them inside a Transaction (OleDbTransaction class), by doing so if one the queries fails all changes are rolled back.

    Regards,
    Timur






    0
  • Avatar
    Permanently deleted user
    Hi
    Many thanks for your quick response .

    kind regards
    ibrar shah
    0

Please sign in to leave a comment.