Increase count + Write to file

raphael

Client
Регистрация
20.07.2012
Сообщения
62
Благодарностей
4
Баллы
8
Hi all,

already 2 days on a problem now i decide to post it.

The problem is that she run good on debug and the first time in ZP then sometimes in ZP

Project start:

A table directory file_count.txt (This file contain only 1 number) its a scratch file.
Table processing to store first line in a variable_scratch
THEN THE JOB
if the job is complete then
Increase count by 1 of variable_scratch
Then write to file the content of variable_scratch

ok it work in debug file count upgraded
it work 1 times on 5 in ZennoPoster (1 thread)

Thanks for you help.
 

raphael

Client
Регистрация
20.07.2012
Сообщения
62
Благодарностей
4
Баллы
8
Ok i, have reduce the function to the strict minimal:

00005.jpg



Get the number into to the file to a variable
Increase by one the number of the variable
Write the number of the variable into the file (in place of the line)


Normally if begin with 0 after 10 run it must be 10 in the file.
Here after 10 run
 

drvosjeca

Client
Регистрация
26.10.2011
Сообщения
512
Благодарностей
455
Баллы
63
well... this works fine for me, but I have used "Files" block instead of "list processing"... which is more simple in this case when you need to load just one number. Set it to get text and delete, and at the end you have same, but for writting text
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 715
Баллы
113
Don't use write to file action if you use multithreading. It's good for 1 time.

Just check in list/table settings "save changes" , put path to the file and use action add line in list/table proccesings actions.
All will be saved automatically and without any problems

Anton
 

drvosjeca

Client
Регистрация
26.10.2011
Сообщения
512
Благодарностей
455
Баллы
63
Sorry rostonix, but you got it wrong again i think...

He said that he is using 1 thread in his first post... and even if he would not say it, it is understandable that he cant pick number from same file (because he have just one number inside), increase counter and save it back in multithreading mode because threads would run into eachother, and it wouldnt work. For multithreading and this single txt scenario he would need global counter... :D

So like said in my previouse post, dont need any list and list processing for that (yes he can use it with save to file), but this option with direct text grab will work just fine ;-)
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 715
Баллы
113
well... this works fine for me, but I have used "Files" block instead of "list processing"... which is more simple in this case when you need to load just one number. Set it to get text and delete, and at the end you have same, but for writting text
This will work!) :az:

Good morning for me )
 

raphael

Client
Регистрация
20.07.2012
Сообщения
62
Благодарностей
4
Баллы
8
yeah this work beter but


i set 0 in the external file
i lunch it in zeno

Make a +1 (1 threat) result 1 in the file
ok i reset to 0
delete the job in ZP
import the job in ZP
Make a +10 (1 threat) result 10 in the file
ok i reset to 0
delete the job in ZP
import the job in ZP
Make a +100 (1 threat) result 99 in the file :confused:


Here the minimal job:

Посмотреть вложение ArchiveCounter.zip
 

raphael

Client
Регистрация
20.07.2012
Сообщения
62
Благодарностей
4
Баллы
8
Yeah i have found the bug


After a restart of the ZP app 0 +100 result 100
without restart ZP
ok i reset to 0
delete the job in ZP
import the SAME job in ZP
Make a +100 (1 threat) result 99
 

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