i am looping over a query - inside the loop, i am calling a udf that calls 
another udf...

for( i = 1; i lte qQuery.RecordCount; i = i+1 ) {
  WriteOutput(DrawRow(qQuery.colA[i]), Trim(qQuery.colB[i])));
}

function DrawRow(someNo, someAmt) {

  var rRow = "";                
  var thisRow = SetValue(someNo, someAmt);
        
  for( i = 1; i lte ArrayLen(thisRow); i = i+1 ) {
    rRow = rRow & '<td align="right" class="' & IIf(thisRow[i] lt 0, 
DE("negative"), DE("")) & '">';
    rRow = rRow & IIf(thisRow[i] gt 0, DE(DecimalFormat(thisRow[i])), 
DE("&nbsp;")) & '</td>';
  }
  return rRow;  // return a string
}

function SetValue(someNo, someAmt) {
  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
}

however, the call to the DrawRow() udf in the query loop works for the first 
iteration, then breaks out of the loop therfore ignoring any subsequent records.

does anyone see a possible reason for this?

at first i thought it maybe the use of break in the case statements in the 
SetValue udf, so i changed to using if/else if, but that produced the same 
results.

i also tried using global variables instead of function-local vars for the 
array - still no luck.

it really seems as though something wacked is happening after the first 
iteration of the query loop that is causing the loop to end prematurely, but i 
can seem to pin it down.

this is in cf5 btw <cringe>

tia!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:210375
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

Reply via email to