>You didn't declare i in DrawRow() with the var keyword -- that's your
>problem, since it's overwriting the variable i you're using to loop
>over the query...
duh - thanks everyone - i just changed the i to var j for more clarity and it
works perfectly with the following code...
for( i = 1; i lte qQuery.RecordCount; i = i+1 ) {
WriteOutput(DrawRow(qQuery.colA[i]), Trim(qQuery.colB[i])));
}
function DrawRow(someNo, someAmt) {
var j = 0;
var rRow = "";
var thisRow = SetValue(someNo, someAmt);
for( j = 1; j lte ArrayLen(thisRow); j = j+1 ) {
rRow = rRow & '<td align="right" class="' & IIf(thisRow[j] lt 0,
DE("negative"), DE("")) & '">';
rRow = rRow & IIf(thisRow[i] gt 0, DE(DecimalFormat(thisRow[j])),
DE(" ")) & '</td>';
}
return rRow; // return a string
}
function SetValue(someNo, someAmt) {
var aRow = ArrayNew(1);
ArraySet(aRow, 1, 5, 0);
switch (someNo) {
case "082": {
aRow[1] = someAmt;
break;
}
case "126": {
aRow[2] = someAmt;
break;
}
case "153": {
aRow[3] = someAmt;
break;
}
case "176": {
aRow[4] = someAmt;
break;
}
case "301": {
aRow[5] = someAmt;
break;
}
}
return aRow; // return an array
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:210409
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54