issue with table synchronization with file

bill

Client
Регистрация
05.07.2014
Сообщения
355
Благодарностей
9
Баллы
18
i'm having a problem with tables. I set it to bind table to a file, and i'm using a C# code to check a variable against a table. It's suppose to tell me whether or not the variable is already in the table. The problem is that when i restart the project, or close it in zennoposter, it forgets the contents of the table. In otherwords, it checks it and says that it wasn't in the table even though it is. It remembers it was in the table as long as i don't stop the job. It worked fine until i tried running it recently.

Im adding lines to the table using add line to table and word processing. When i use just word processing it doesn't seem to add right, because it says its not in the table when checking it using C# code. only when i use add line to table does it work and see that it is in the file.

The data i am scraping with add line to table gives me the error below, and i was told to use word processing, which i did, but then it didn't find it in the table when using the C# code to check against the table.
error5.jpg
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
Can you attach simple example wto reproduce error when you use Word processing?
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
It's not error in logs by the way
it's warning
 

bill

Client
Регистрация
05.07.2014
Сообщения
355
Благодарностей
9
Баллы
18
Can you attach simple example wto reproduce error when you use Word processing?
there isnt a error when using word processing, the problem is it doesnt seem to add to the table even though it is set to. It is adding to the file the table is binded to, but when i run the c# code to check if its in the table it says it isn't, whereas, if i use the add line to table action it will say that it is in the table when running the same c# code.
 

bill

Client
Регистрация
05.07.2014
Сообщения
355
Благодарностей
9
Баллы
18
the only extra information i can give is that the data its scraping and adding to the table looks like this:

texthere


texthere

now when i add it using word processing it doesn't detect that its in the table using my c# code, but when it is added through add to table action it does detect that its in the table. here's the code i'm using:

Код:
// take text for search from a variable
var textContains = project.Variables["tableSearchTextContains"].Value;
// get table for search
var sourceTable = project.Tables["Table2"];
// search in each row
lock(SyncObjects.TableSyncer)
{
    for(int i=0; i < sourceTable.RowCount; i++)
    {
        // read a row (array of cells)
        var cells = sourceTable.GetRow(i).ToArray();
        // loop through all cells
        for (int j=0; j < cells.Length; j++)
        {
            // check if cell contains specified text, if there are matches return "yes"
            if (cells[j].Contains(textContains))
                return "yes";
        }
    }
}
// if nothing found return "no"
return "no";
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
Most likely text has symbols which act like delimeters that's why you cannot find them when you use not proper action (Word processing)
 

bill

Client
Регистрация
05.07.2014
Сообщения
355
Благодарностей
9
Баллы
18
Most likely text has symbols which act like delimeters that's why you cannot find them when you use not proper action (Word processing)
sometimes text has ( ) in it. it adds same text from variable using word processing as it does using add line to table action... but it doesn't show it as in the table when i run the c# to check it when it is added through word processing... but it should right?

that aside, it isn't remembering the data in the table when i restart the job, which it should.
 
Последнее редактирование:

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
Tabs, linebreaks, ;
 

bill

Client
Регистрация
05.07.2014
Сообщения
355
Благодарностей
9
Баллы
18

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
Cause if you have linebreaks, then data will be stored in several lines of table. And you're looking for it in 1 line
 
  • Спасибо
Реакции: bill

bill

Client
Регистрация
05.07.2014
Сообщения
355
Благодарностей
9
Баллы
18
just needed to trim it thanks
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)