问题
Hello I have been tasked with replacing all evaluate() functions in this coldfusion app. I am having some issues with some fairly complex evaluations and I just can't figure it ou.
When it is a simple change like This:
<cfif isNumeric(evaluate("form.value_#REPORT_FIELD_ID#"))>
To This:
<cfif isNumeric(form["value_" & REPORT_FIELD_ID])>
It's all good but for this:
<cfif evaluate("qrySearch.#qryReportFields.FIELD_NAME[qryReportFields.currentRow]#") eq true>
Not so much
I have tried several things. I thought this would work
<cfif qrySearch[#qryReportFields.FIELD_NAME[qryReportFields.currentRow]#] eq true>
But it throws a Complex object types cannot be converted to simple values. error.
Any help would be greatly appreciated.
回答1:
I believe if you use bracket notation for query column name you have to also include row number.
<cfif qrySearch[qryReportFields.FIELD_NAME[qryReportFields.currentRow]][qrySearch.currentrow] eq true>
Or just pass 1 instead of currentrow if only one record, not in loop, etc
来源:https://stackoverflow.com/questions/44075509/trying-to-replace-all-evaluate-functions-with-dynamic-notation-in-coldfusion-9