奇妙な問題が発生しています...データテーブル JSON オブジェクトの作成に使用する cfscript をセットアップしましたが、「X の位置にある要素が見つかりません」という未処理の例外エラーが発生することがあります。通常、X は 1 以上です私の配列には実際にあるので、私の場合、配列に44個の要素があり、式エラーは常に「位置45が見つかりません」と表示されます
ここにいくつかのコードがあります
/* 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 ) ? ',' : '');
}
};
この問題の奇妙な部分は、エラーを正確に再現できないことです。これは、時折発生するヒットまたはミスのことです。
このスクリプトは AJAX 経由で GET によって実行されます
何か案は?