Topic Options
#55317 - 09/21/17 01:47 PM Script to calculate total in a .txt file
sygui Offline
OL Expert

Registered: 11/02/10
Posts: 151
I have a text file. I want a script to make the total of all numbers that are located at column 107.

here is a sample of my file:

CONSUMERS XXX INC 04150000000055668 MOR000000000005566 PREPAID 2560 3
2970 watt, UNIT 5
BARRIE ON L5G 6B5
-----------------------------------------------------------------------------------------------------------------------------

15527375-00
ATL COMPANY INC 04150000000055620 MOR000000000005562 PREPAID 11220 17
3500 TOMKEN ROAD
MISSISSAUGA ON L1V 1W8

Top
#55318 - 09/21/17 02:08 PM Re: Script to calculate total in a .txt file [Re: sygui]
Jean-Cédric Online   content
OL Expert

Registered: 10/03/16
Posts: 482
Loc: Québec, Canada
define(&total,integer,0)
define(&i,integer,0)

for(&i;<line start>;<increment amount>;<stop line>)
&total := &total + strtoint(@(<line number>,<starting column>,<ending coloumn>))
endfor()

Of course all the <...> needs to be replace by actual values.

Top
#55319 - 09/21/17 06:26 PM Re: Script to calculate total in a .txt file [Re: Jean-Cédric]
sygui Offline
OL Expert

Registered: 11/02/10
Posts: 151
[i][/i]Ok i will try. Where is it going to put the total?
I get error W3602 error 0 on line 1 column 8 and error w3603


Edited by sygui (09/22/17 07:39 AM)

Top
#55322 - 09/22/17 10:50 AM Re: Script to calculate total in a .txt file [Re: sygui]
Jean-Cédric Online   content
OL Expert

Registered: 10/03/16
Posts: 482
Loc: Québec, Canada
You need to adapt and understand the script....just copy and paste it will probably don't work.

Top
#55331 - 09/24/17 07:32 AM Re: Script to calculate total in a .txt file [Re: Jean-Cédric]
sygui Offline
OL Expert

Registered: 11/02/10
Posts: 151
Ok thanks but i don't know anything about script so i can't adapt it

Top
#55340 - 09/25/17 11:20 AM Re: Script to calculate total in a .txt file [Re: sygui]
Jean-Cédric Online   content
OL Expert

Registered: 10/03/16
Posts: 482
Loc: Québec, Canada
Unfortunately, we do not provide scripting solution. You might want to ask someone you know to look at the script and adapt it or you can mandate us to do it for you.
In the latter, contact you OL Reseller.
We also have a training on PressTalk available. Again, see with your OL Reseller.

Top