Get value from txt for export

  • 100 Views
  • Last Post 20 January 2020
  • Topic Is Solved
Dias Duisembayev posted this 20 January 2020

Good afternoon, I have a document which has a serial number. For example: 1102002. ABBYY extracts this nubmer well. However, for an export, I do not need this serial number. I have a txt file which contains key-value pairs of serial number and organization name which has this number. Example: 1102002 - "Global Invest". So, I need to get that "Global Invest" string from txt given that ABBYY recognized serial number. What is the way to do this? 

Dias Duisembayev posted this 20 January 2020

I was able to do this using C# script. I created an extra field in document definition and wrote this script:

 

using System;

using System.IO;

using (StreamReader sr = new StreamReader(@"LOCATION"))

{

    string s;

    while ((s = sr.ReadLine()) != null)

    {

        string[] lines = s.Split('|');

        if (Context.Field("SerialNumber").Text == lines[0]) {

        Context.Field("MyField").Value = lines[1];

        break;

        }

    }

 

}

Close