我循环查询结果,我需要限制显示的行数.我需要使用,cfoutput因为我正在使用该group属性,我不能使用它,maxrows因为不会显示所有行.
我尝试在<cfbreak>里面使用<cfoutput>,但是会抛出一个错误.
我怎么能摆脱<cfoutput>循环?
不确定这是否可行.我想要做的是通过查询构建输出字符串.我连接输出"名称"并将"值"附加到结尾.然后输出字符串.我不认为这是可能的.但我正在寻找任何替代方案.
所以这就是我所拥有的:
qry1是主要的查询.qry2获取要追加到字符串末尾的值.所以变量的值test看起来像这样:"variables.qry1.100"
这是有意义的,qry1因为这是查询对象的一部分.那么这个字符串将从数据库中返回一个正确的值,因为有一个名为100的子查询
<cfoutput>
<cfloop query="variables.qry2">
<cfset test = variables.qry1. & variables.qry2.#valueID#>
<td>#test#</td>
</cfloop>
</cfoutput>
Run Code Online (Sandbox Code Playgroud)
非常感谢.
JC
考虑以下:
<cfoutput query="resources" group="type">
<h4>#type#</h4>
<cfoutput>
#name#
</cfoutput>
</cfoutput>
Run Code Online (Sandbox Code Playgroud)
resources.recordcount会给我记录的总数,但有没有一种优雅的方法来查找嵌套数据的记录数?例如
<cfoutput query="resources" group="type">
<h4>#type# (#noofrecords# of #resources.recordcount#)</h4>
<cfoutput>
#name#
</cfoutput>
</cfoutput>
Run Code Online (Sandbox Code Playgroud)
我可以用循环来做一些hacky,但是想知道是否有一种方法可以使用cfoutput组专门做到这一点.
我有一个包含2个查询的结构.我有一个变量与其中一个查询的"键",我想使用该变量动态输出查询.我的基本代码:
<cfquery name="myQueries.names" ... >...</cfquery>
<cfquery name="myQueries.places" ... >...</cfquery>
<cfset queryName = "places" />
<cfoutput query="myQueries[queryName]">
...
</cfoutput>
Run Code Online (Sandbox Code Playgroud)
这给了我错误 Attribute validation error for tag cfoutput.
cfoutput"query"属性似乎不支持括号表示法.如何从cfoutput访问查询?
我有一个查询,让所有员工都在表中计算:
emp_namelast | emp_namefirst | employeetotal | year_cse1
--------------------------------------------------------
smith | john | 13 | 2014
smith jr | jonnny | 10 |2014
baker |jane |5 |2015
doe |john |6 |2015
Run Code Online (Sandbox Code Playgroud)
我在表格中输出结果.我从查询中按顺序获得结果.但是,根据下面的代码,它输出了2014年的最高结果,然后是2015年的最高结果.
我尝试过不使用任何组,它从查询中提供了所有数据.我希望它能够在两个不同的表格中输出2014年和2015年的数据.一个将包含2014年和2015年的记录.
是否必须在不使用"群组"的情况下完成?
<h2>employees</h2>
<table >
<thead><tr><th>Employee</th><th>Stars</th></tr></thead>
<tbody>
<cfoutput query="GetEmployeeTotals" group="year_cse1">
<tr><td>#emp_namefirst# #emp_namelast#</td>
<td>#employeetotal#</td>
</tr>
</cfoutput>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud) 我不是百分之百在何时使用cfoutput以及如何在以下示例中使用cfoutput.整个cfmail应该包含在cfoutput中吗?
背景:我有一个基于if语句发送电子邮件的函数.电子邮件的消息包含来自cfquery的变量.
<cffunction name="emailUpdate" access="public" returntype="string">
<cfargument name="usr_email" required="yes">
<cfargument name="status_update" required="yes">
<cfargument name="form_id" required="yes">
<cfquery name="emailformData" datasource="RC">
SELECT *
FROM Basic_Info
WHERE ID = <cfqueryparam value="#ARGUMENTS.form_id#">
</cfquery>
<cfoutput query="emailformData">
<cfmail
from="forms@email.us"
to="#usr_email#"
subject="Status Update">
<cfif status_update EQ 'Submitted'>
Form Submitted: The following quote request ID: #emailformData.ID# has been submitted on
#emailformData.Submission_Date# for the following party #emailformData.Sold_to_Party#. You will receive automated
updates via email when your submission changes status. <b>- Admin Team</b>
<cfelseif status_update EQ 'Assigned'>
Form Assigned by …Run Code Online (Sandbox Code Playgroud)