what's wrong with this code?

sonatine

Client
Регистрация
20.08.2014
Сообщения
206
Благодарностей
2
Баллы
18
hi everyone,
my friend wrote a code for me to do this:
read text file (test1.txt), make a regex and find a certain phrase in a table and when it finds that, write the link from text file on E column in table.
nothing is wrong with this template but when u run it, just the last change save in table and we don't know why.
i mean there is loop to read the three first raws of text file.
the code put the third line in right place in table but after that nothing changes and no more lines will be added to table.
can anyone explain the reason or correct the code?
i wanna read the text file, make a regex to create a certain phrase and search that in table1 and when it finds that copy the original line from text file to column E in table1.

i attached the template.
 

Вложения

  • 18,8 КБ Просмотры: 153

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 452
Благодарностей
5 910
Баллы
113
You may find out it by yourself:
PM_log.png
 

Nord

Client
Регистрация
22.03.2012
Сообщения
2 404
Благодарностей
1 471
Баллы
113
hi everyone,
my friend wrote a code for me to do this:
read text file (test1.txt), make a regex and find a certain phrase in a table and when it finds that, write the link from text file on E column in table.
nothing is wrong with this template but when u run it, just the last change save in table and we don't know why.
i mean there is loop to read the three first raws of text file.
the code put the third line in right place in table but after that nothing changes and no more lines will be added to table.
can anyone explain the reason or correct the code?
i wanna read the text file, make a regex to create a certain phrase and search that in table1 and when it finds that copy the original line from text file to column E in table1.

i attached the template.

Allright with your template =)
 

sonatine

Client
Регистрация
20.08.2014
Сообщения
206
Благодарностей
2
Баллы
18

sonatine

Client
Регистрация
20.08.2014
Сообщения
206
Благодарностей
2
Баллы
18

Allright with your template =)
it runs okay, but see this picture:
upload_2017-8-12_11-34-16.png


but see my table:
upload_2017-8-12_11-35-20.png


nothing just test phrase!
this code must put this link:
public.upera.co/6fygfiwc#3 Doors Down The Greatest Hits[2012]Mp3-320kps.rar
in front of
3 Doors Down The Greatest Hits[2012]Mp3-320kps
but it does nothing :(
i don't know why...
can u correct this code for me?
i want take lines from text files and put them on this table on E column in front of corresponding phrase.
 

Nord

Client
Регистрация
22.03.2012
Сообщения
2 404
Благодарностей
1 471
Баллы
113
it runs okay, but see this picture:
Посмотреть вложение 22753

but see my table:
Посмотреть вложение 22754

nothing just test phrase!
this code must put this link:
public.upera.co/6fygfiwc#3 Doors Down The Greatest Hits[2012]Mp3-320kps.rar
in front of
3 Doors Down The Greatest Hits[2012]Mp3-320kps
but it does nothing :(
i don't know why...
can u correct this code for me?
i want take lines from text files and put them on this table on E column in front of corresponding phrase.
Based on this code you just write "Test" in all cell in "E" collumn...
 
  • Спасибо
Реакции: sonatine

sonatine

Client
Регистрация
20.08.2014
Сообщения
206
Благодарностей
2
Баллы
18

Nord

Client
Регистрация
22.03.2012
Сообщения
2 404
Благодарностей
1 471
Баллы
113
okay! accepted. i don't have time to explain what's that for, my friend must say that.
so what can i do to change that to addressed from text file?
Change code on this one:
Код:
var List1 = project.Lists["List1"];
project.Variables["link"].Value=List1.Count.ToString();
for(int j=0;j<List1.Count ;j++)
{
    var listItems=List1[j];
    string resRegex=listItems.ToString().Substring(listItems.ToString().IndexOf('#')+1).Replace(".rar","");
    lock(SyncObjects.TableSyncer)
    {
        for(int i=0; i<project.Tables["Table1"].RowCount; i++)
        {
            var rowItems=project.Tables["Table1"].GetRow(i).ToArray();
            if(rowItems[0].ToString().ToLower()== resRegex.ToString().ToLower())
            {
                project.Tables["Table1"].SetCell("E",i,listItems.ToString());
            }
        }
    }
}
Than you will got



Is this what you wanted?
 

sonatine

Client
Регистрация
20.08.2014
Сообщения
206
Благодарностей
2
Баллы
18
now that's what i'm talking about!
as always you helped me another time!
muchas gracias mi amigo!
give me some time to dance in my joy and i'll be back if i had more questions.
 

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