【发布时间】:2015-06-13 07:36:59
【问题描述】:
我有一个 CFC 对象和一个函数,可以获取我想要的数据。现在我想使用该数据并将其提供给已定义的 custom tag 属性。当我转储#iEngine.listScore()# 时,我得到了一些参数。但我的问题是我应该如何将这些提供给属性?
<cfdump var="#iEngine.listScores()#" label="Swapnil Test - Function ListScore">
<cfset filename="ACE_DataExtract_#DateFormat(now(),'dd.mmm.yyyy')#.xls" />
<!--- Calling Custom tags to create/output xls files --->
<cfmodule template="#request.library.customtags.virtualpath#excel.cfm" file="#filename#" sheetname="ACE Report">
<cfmodule template="#request.library.customtags.virtualpath#exceldata.cfm"
query="#iEngine.listScores()#"
action="AddWorksheet"
sheetname="ACE Report"
colorscheme="blue"
useheaders="true"
contentformat="#{bold=true}#"
customheaders="#ListScore#">
<cfoutput>Excel Extract - ACE Report - #DateFormat(Now(),"d-mmm-yyyy")#</cfoutput>
</cfmodule>
</cfmodule>
这里我想将iEngine.listScore()的数据提供给“exceldata”自定义标签中的“Query”属性。
下面是iEngine.listScore()的转储
【问题讨论】:
-
query=iEngine.listScores() 应该可以工作。没有双引号,没有英镑符号。此外,您的自定义标签看起来需要查询,而您显示的转储是一个结构
-
正确。我的自定义标签需要查询。我会尽量按照你的建议直接放;会让你知道。谢谢
-
您还需要修改您的函数,以便返回类型为查询。祝你好运,编码愉快:)
-
澄清一下,query=iEngine.listScores() 仅在
iEngine.listScores()返回查询时才有效 - 但事实并非如此。它返回一个结构数组。因此,您要么需要修改 CFC 方法,使其返回查询并将该对象传递到自定义标记中,要么修改自定义标记以接受结构数组。
标签: coldfusion cfc cfml