尝试用ColdFusion 9中的动态符号替换所有评估函数 [英] Trying to replace all evaluate functions with dynamic notation in ColdFusion 9
问题描述
您好,我的任务是替换此Coldfusion应用程序中的所有validate()函数。我在进行一些相当复杂的评估时遇到了一些问题,但我无法理解。
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#"))>
到此:
<cfif isNumeric(form["value_" & REPORT_FIELD_ID])>
一切都很好,但是为此:
It's all good but for this:
<cfif evaluate("qrySearch.#qryReportFields.FIELD_NAME[qryReportFields.currentRow]#") eq true>
不是很多
我尝试过几件事。我以为这会起作用
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.
任何帮助将不胜感激。
推荐答案
I相信如果对查询列名称使用括号表示法,则还必须包括行号。
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>
或者,如果只有一条记录而不是循环,则只传递1而不是当前行
Or just pass 1 instead of currentrow if only one record, not in loop, etc
这篇关于尝试用ColdFusion 9中的动态符号替换所有评估函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!