I have a query which returns multiple results with just data in one column as different for a particular report number. I want to group the results for one report number and sen
I believe your actual problem is that you're using pound signs in the group attribute.
group="#investigation_id#"
should be group="investigation_id"
--Edit--
This below answer is moot as the OP was misleading.
I think this is because you do not need cfoutput
tags inside the cfmail
tag. It's odd that it causes a mail error, though.
anyway...
I would try using cfsavecontent
then output the variable in the cfmail
.
<cfsavecontent variable = "mailBody">
<cfoutput query="qryCorrectiveDueDate" group="investigation_id">
<b>#action_who_email#</b><br>
<cfoutput>
Report ID: #report_id#</br>
Report Number: #report_number#</br>
investigation id: #investigation_id#</br>
Action Who :#action_who#</br>
Action What: #action_what#</br>
Action When: #action_when#</br>
Action type:#action_type#</br>
Action Complete Date: #action_complete_date#</br></br>
</cfoutput>
</br>
</cfoutput>
</cfsavecontent>
<cfmail ...>
#mailBody#
</cfmail>
Now that you've removed the hash tags, your issue is likely a missing cfoutput
tag in the email. Similar to the group attribute of the cfoutput
tag, you need another cfoutput
tag to loop through the grouped records.
Tested on CF8 locally.
<cfmail query="q" group="field">
<cfoutput>
#field# - #field2#
</cfoutput>
</cfmail>