[SOLVED] Read line issues

teehee

Client
Регистрация
26.09.2012
Сообщения
41
Благодарностей
1
Баллы
8
Hey,

I have a strange error which seems to happen from time to time and was wondering if there is anyway to solve it.

I have templates using table processing which when started take the last line from a .txt file and append a line to the .txt file once completed.

The issue I have is that sometimes when the template finishes and is run again, it does not get the new last line added to the .txt file.

This is a bit confusing to explain so I'll try:

File lines:
line 1
line 2

Template run #1 > gets last line (line 2) from txt file > adds 'line 3' to txt file > finished

File lines:
line 1
line 2
line 3

Template run #2 > gets last line (line 3) from txt file > adds 'line 4' to txt file > finished

File lines:
line 1
line 2
line 3
line 4

Template run #3 > gets last line (line 3) from txt file > adds 'line 5' to txt file > finished

File lines:
line 1
line 2
line 3
line 4
line 5

Template run #4 > gets last line (line 5) from txt file > adds 'line 6' to txt file > finished

As you can see it takes the wrong line in the third execution. I've been using the 'Get rows count' feature to determine where the last line is in the .txt file.

Thanks for any help :-)
 

hotohori

Client
Регистрация
10.02.2012
Сообщения
154
Благодарностей
40
Баллы
28
Hi teehee,

Are you using the Process File action to write to last line and had "Save changes of table to file" checked in the table?
If you are, then that's where the problem is. Writing text to file with Process File action does not work well when the same file is in sync with a table. Use Table Processing > Add Line instead.
 
  • Спасибо
Реакции: teehee

teehee

Client
Регистрация
26.09.2012
Сообщения
41
Благодарностей
1
Баллы
8
Hi hotohori,

That was the problem :-)

Everything is working fine now, thanks for your help!
 

hotohori

Client
Регистрация
10.02.2012
Сообщения
154
Благодарностей
40
Баллы
28
You're welcome :-)
 

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