
Quote from joferar333 on May 23, 2022, 1:36 am@luishp,@asleycruz, v@vadim,daviddeargentina,@gaev
ESPAÑOL
Tengo un archivo que va guardando en cada linea un valor numerico...
Luego necesito el total de la suma de todas las lineas para asignarselo a una variable
Yo lo hago asi
FileLen "[pubdir]saldoricardo.dat" "[saldov]" Loop "1" "[saldov]" "[X]" FileRead "[pubdir]saldoricardo.dat" "1" "[saldo[X]]" Math "[saldo[X]]+[saldo[X]]" "0" "[deuda]" EndLoop
Pero me suma solo el ultimo registro con el mismo registro...
Alguna idea para solucionar esto y que me sume todas las lineas y me de el resultado?
INGLES
I have a file that is keeping a number value on each line ...
Then I need the total sum of all the lines to assign it to a variable
I do it like that
But I am only adding the last record with the same record ...
Filelen "[Pubdir] Sabericardo.dat" "[balance]" Loop "1" "[balance]" "[x]" FileRead "[pubdir] Sabericardo.dat" "1" "[balance [x]]" Math "[balance [x]]+[balance [x]]" "0" "[debt]" Endloop
Any idea to solve this and that all the lines add to me and I give me the result?
GRACIAS
THANKS
@luishp,@asleycruz, v@vadim,daviddeargentina,@gaev
ESPAÑOL
Tengo un archivo que va guardando en cada linea un valor numerico...
Luego necesito el total de la suma de todas las lineas para asignarselo a una variable
Yo lo hago asi
FileLen "[pubdir]saldoricardo.dat" "[saldov]" Loop "1" "[saldov]" "[X]" FileRead "[pubdir]saldoricardo.dat" "1" "[saldo[X]]" Math "[saldo[X]]+[saldo[X]]" "0" "[deuda]" EndLoop
Pero me suma solo el ultimo registro con el mismo registro...
Alguna idea para solucionar esto y que me sume todas las lineas y me de el resultado?
INGLES
I have a file that is keeping a number value on each line ...
Then I need the total sum of all the lines to assign it to a variable
I do it like that
But I am only adding the last record with the same record ...
Filelen "[Pubdir] Sabericardo.dat" "[balance]" Loop "1" "[balance]" "[x]" FileRead "[pubdir] Sabericardo.dat" "1" "[balance [x]]" Math "[balance [x]]+[balance [x]]" "0" "[debt]" Endloop
Any idea to solve this and that all the lines add to me and I give me the result?
GRACIAS
THANKS
Quote from Gaev on May 23, 2022, 5:26 am@joferar333
Assuming that each line contains a number e.g. ...
123
234
111
56
9
etc.... that you are attempting to sum/total, try this ...
Setvar "[deuda]" "0" FileLen "[pubdir]saldoricardo.dat" "[saldov]" Loop "1" "[saldov]" "[X]" FileRead "[pubdir]saldoricardo.dat" "1" "[saldo[X]]" Math "[deuda] + [saldo[X]]" "0" "[deuda]" EndLoop
Assuming that each line contains a number e.g. ...
123
234
111
56
9
etc.
... that you are attempting to sum/total, try this ...
Setvar "[deuda]" "0" FileLen "[pubdir]saldoricardo.dat" "[saldov]" Loop "1" "[saldov]" "[X]" FileRead "[pubdir]saldoricardo.dat" "1" "[saldo[X]]" Math "[deuda] + [saldo[X]]" "0" "[deuda]" EndLoop

Quote from joferar333 on May 23, 2022, 11:44 amHi @gaev thanks for your help...
bad not found, the result the sum to all lines to archivo no found.
see the example in de pub....
Hi @gaev thanks for your help...
bad not found, the result the sum to all lines to archivo no found.
see the example in de pub....
Uploaded files:
Quote from Gaev on May 23, 2022, 4:42 pm@joferar333
a) I do not speak Spanish
b) The file named saldoricardo.dat has just one line (containing a 0) in it
c) Please upload a copy of this file so I can see what it contains BEFORE the Loop/EndLoop code block
a) I do not speak Spanish
b) The file named saldoricardo.dat has just one line (containing a 0) in it
c) Please upload a copy of this file so I can see what it contains BEFORE the Loop/EndLoop code block

Quote from joferar333 on May 24, 2022, 12:36 am@gaev
Thank you again! I can't make the total lines add ...
Forget the pub that I uploaded, you could give me an example of the way you make you add the total lines of a file that contains line lines and you of El Total in a variable based on the code that passed me, to See you you can make you join you .... Just assemble a text file that contains 5 or 6 lines with numbers and summers to get the total ..... I will be eternally grateful since I do not achieve this that it must be a nonsense but I surpass me ...
Thank you again! I can't make the total lines add ...
Forget the pub that I uploaded, you could give me an example of the way you make you add the total lines of a file that contains line lines and you of El Total in a variable based on the code that passed me, to See you you can make you join you .... Just assemble a text file that contains 5 or 6 lines with numbers and summers to get the total ..... I will be eternally grateful since I do not achieve this that it must be a nonsense but I surpass me ...

Quote from joferar333 on May 24, 2022, 12:47 am@gaev
I new found.... i fix the error tu script....
1 Setvar "[deuda]" "0" 1 FileLen "[pubdir]saldoricardo.dat" "[saldov]" 3 Loop "1" "[saldov]" "[X]" 4 FileRead "[pubdir]saldoricardo.dat" "1" "[saldo[X]]" 5 Math "[deuda] + [saldo[X]]" "0" "[deuda]" 6 EndLoop The error in line 4 saldoricardo.dat" "1" "[saldo[X]] the ok and found 1 Setvar "[deuda]" "0" 1 FileLen "[pubdir]saldoricardo.dat" "[saldov]" 3 Loop "1" "[saldov]" "[X]" 4 FileRead "[pubdir]saldoricardo.dat" "[x]" "[saldo[X]]" 5 Math "[deuda] + [saldo[X]]" "0" "[deuda]" 6 EndLoopThanks!!!!!
I
I new found.... i fix the error tu script....
1 Setvar "[deuda]" "0" 1 FileLen "[pubdir]saldoricardo.dat" "[saldov]" 3 Loop "1" "[saldov]" "[X]" 4 FileRead "[pubdir]saldoricardo.dat" "1" "[saldo[X]]" 5 Math "[deuda] + [saldo[X]]" "0" "[deuda]" 6 EndLoop The error in line 4 saldoricardo.dat" "1" "[saldo[X]] the ok and found 1 Setvar "[deuda]" "0" 1 FileLen "[pubdir]saldoricardo.dat" "[saldov]" 3 Loop "1" "[saldov]" "[X]" 4 FileRead "[pubdir]saldoricardo.dat" "[x]" "[saldo[X]]" 5 Math "[deuda] + [saldo[X]]" "0" "[deuda]" 6 EndLoop
Thanks!!!!!
I