Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WHAT'S WRONG WITH THE FOLLOWING SOU

Status
Not open for further replies.

TC2000

Programmer
Dec 28, 2000
32
0
0
HK
WHAT'S WRONG WITH THE FOLLOWING SOURCE ??

<CFQUERY NAME=&quot;GetQTask&quot; DATASOURCE=&quot;eKong&quot;>
Select * from QTask where wStatus ='P'
</CFQUERY>

<cfmail query=&quot;GetQTask&quot;
FROM=&quot;tonychan@algoltec.com&quot;
TO=&quot;#GetQTask.EMail#&quot;
SERVER=&quot;192.168.1.254&quot;
PORT=&quot;25&quot;
SUBJECT=&quot;#GetQTask.ESubject#&quot;>

#GetQTask.content# <BR><BR>
<CFDIRECTORY action=&quot;list&quot; directory=&quot;#APPLICATION.DATAPATH##UQ1.TemplateName#\html\&quot;
FILTER=&quot;*.*&quot; name=&quot;dircontents&quot;>

<CFIF dircontents.RecordCount GT 0>
<cfoutput query=&quot;dircontents&quot;>
<CFIF len(dircontents.name) GT 2>
<cfinclude TEMPLATE=&quot;#APPLICATION.DATAPATH##UQ1.TemplateName#\html\#dircontents.name#&quot; >
</CFIF>
</cfoutput>
</cfif>

</cfmail>

I GOT THIS ERROR MESSAGE :
A query driven CFOUTPUT tag is nested inside a CFMAIL tag that also has a QUERY= attribute. This is not allowed. Nesting these tags implies that you want to use grouped processing. However, only the top-level tag can specify the query that drives the processing.

CAN I DEFINE QUERY INSIDE THE <cfmail> TAG ????

THANKS IN ADVANCE....
 
Give this a try: (basically changing CFOUTPUT to CFLOOP)

Code:
<CFQUERY NAME=&quot;GetQTask&quot; DATASOURCE=&quot;eKong&quot;>
    Select * from QTask where wStatus ='P'
</CFQUERY>

<cfmail query=&quot;GetQTask&quot; 
FROM=&quot;tonychan@algoltec.com&quot;
TO=&quot;#GetQTask.EMail#&quot;
SERVER=&quot;192.168.1.254&quot;
PORT=&quot;25&quot;
SUBJECT=&quot;#GetQTask.ESubject#&quot;>
    
#GetQTask.content# <BR><BR>
<CFDIRECTORY action=&quot;list&quot;    directory=&quot;#APPLICATION.DATAPATH##UQ1.TemplateName#\html\&quot; 
FILTER=&quot;*.*&quot; name=&quot;dircontents&quot;>

<CFIF dircontents.RecordCount GT 0>
    <cfloop query=&quot;dircontents&quot;>
        <CFIF len(dircontents.name) GT 2>
    <cfinclude TEMPLATE=&quot;#APPLICATION.DATAPATH##UQ1.TemplateName#\html\#dircontents.name#&quot; >
</CFIF>
    </cfloop>
</cfif>            
        
</cfmail>
 
It works, but what is the different btw <cfoutput> and <cfloop>.

Any idea why we can't use <cfoutput> inside the <cfmail> tag????

Anyway thanks....
 
You CAN use cfoutput inside a cfmail tag, but whenever you nest cfoutput tags, you imply that you want to group your output. This requires slightly different syntax and gives different results.

<cfoutput query=&quot;groupQuery&quot; GROUP=&quot;DepartmentID&quot;>
#Department#
<cfoutput>
#Employee#
</cfoutput>
</cfoutput>

Since your cfmail tag specified a query, the cfoutput tag inside the cfmail tags was essentially a nested cfoutput tag, implying grouped output as the error suggested.

John Hoarty
jhoarty@quickestore.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top