Trying to replace all evaluate functions with dynamic notation in ColdFusion 9

≡放荡痞女 提交于 2019-12-12 04:01:52

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!