#182412 - 2007-11-10 12:25 AM
Re: add fields from csv
[Re: Witto]
|
Witto
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
You are reading the very first line, but you don't do anything with it. I think you should also indent your code, so you see your mistakes like no EndIf. I think it is good habit closing opened files: Close(3) I reformatted your code a bit and put two remarks in it.
Break ON DIM $csv,$bal,$csv_array,$read,$controlnum,$line,$x RedirectOutput("C:\temp\output.txt",1)
$csv="C:\temp\test.csv" If Open(3,$csv) = 0 $read=ReadLine(3) While @ERROR = 0 $read=ReadLine(3) ;This should be placed just before the loop $csv_array=Split($read,"|") If UBound($csv_array)
;Add together first balances ? "Account: " + ($csv_array[5]) + " Balance: " + ($csv_array[71]) $cintndc = Round($csv_array[66],2) $balsndc = $balsndc + $cintndc ;$balsndc ?
;add together second balances $cintproc = Round($csv_array[71],2) $balsproc = $balsproc + $cintproc ;$balsproc ?
Else ;This Else is redundant EndIf Loop
@CRLF
;add together first and second balances $total = $balsndc + $balsproc "Total balance is: " + $total ?
$read = Close(3)
RedirectOutput("") |
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 987 anonymous users online.
|
|
|