ASP Vbscript - Sum array
Posted on 2003-03-04
I use a SQL query to build an array, I then loop through the data collected, and display it.
Without using the SUM command in my SQL statement how can I SUM the array.
the code is as follows
For j = 0 to UBound(vntRowst,2)
sSQLD = "SELECT fldRow_ID,fldInterview_Date,ROUND(fldAmount,2),ROUND(fldGST,2),ROUND(fldTotal_Amount,2),fldInterview_Start_Time,fldBooking_Row_id,fldTotal_Amount FROM tblClient_Invoices_Line WHERE fldClient_Invoices_Row_ID = "&ClientRowID&" ORDER BY fldInterview_Date ASC"
vntRowsD = TIBS.GetSQLRows(Cstr(sSQLD))
Before the next I write the arrays to screen as follows
response.write vntRowsD(0,j) etc
What I would then like to do is add the values
ie X = vntRowsD(0,j) + vntRowsD(j+1) until j reaches its ubound limit.
How can this be done