I am having a strange problem...I have set up a cfscript for use in creating a datatables JSON object, and occasionally I am receiving an unhandled exception error "the element at position X cannot be found" The X typically is one more than my array actually has, so in my case, i have 44 elements in an array, the expression error always states "position 45 cannot be found"
heres some code
/* 44 total items in this array*/
aColumns = ['nd_event_group_id','nd_event_id', 'pref_mail_name', 'request_status_code', "life_gift_pledge_ob_amt", 'activity', ... ];
/* this will return 44 */
iColumnsLen = ArrayLen(aColumns);
...
savecontent variable="rc.aaData" {
for (i=1; i <= rc.qResult.RecordCount ; i++) {
writeOutput('{');
for (col=1; col <= iColumnsLen; col++) {
// the next line is what is referenced by the expression error
// "The element at position 45 cannot be found"
writeOutput('"#aColumns[col]#":#SerializeJSON(rc.qResult[aColumns[col]][i])#');
writeOutput((col NEQ iColumnsLen) ? ',' : '');
}
writeOutput('}');
writeOutput((i NEQ rc.qResult.RecordCount ) ? ',' : '');
}
};
The strange part about this issue is that I cannot recreate the error with any precision, its a hit or miss thing that occasionally happens
this script is ran by a GET via AJAX
any ideas?