emailing reports
I have this and all works good excep the report only gets generated once for the last person in the DB with the emails. I want to loop over the output so each person from the email db get a seperate (personal) report. There are 2 people in my test email DB and we both get the same report even though we have different SalesNumbers. Here is basicaly what im doing:
<cfparam name="SupComp" default="">
<cfparam name="Employee" default="">
<cfquery datasource="Emails" name="GetUsers">
SELECT DISTINCT First, Last, EMail, SalesNumber
FROM test
</cfquery>
<cfloop query="GetUsers">
<CFQUERY NAME="NatActiv" DATASOURCE="NationalAccounts">
SELECT PGMJ5W, PGMJDE
FROM ActiveBulletin
WHERE XXOPER = '#SalesNumber#'
ORDER BY CCUSTN, ProgramType, Item
</CFQUERY>
</cfloop>
<cfdocument name="NationalAccounts" format="pdf" marginbottom=".5" marginleft=".5" marginright=".2" margintop=".4">
-------output from NatActiv Query above-----------
</cfdocument>
<cfquery datasource="Emails" name="GetUsers">
SELECT First, Last, EMail
FROM TEST
</cfquery>
<cfmail to="#EMail#"
from="gwsmith@youngsmarket.com"
subject="National Account Bulletin"
type="HTML"
query="GetUsers">
Attached is your National Accounts Bulletin.
<cfmailparam
file="NationalAccountsBulletin.pdf"
type="application/pdf"
content="#NationalAccounts#"
/>
</cfmail>
Reports have been sent.
anyone elso doing this?
Thanks
George
