Hi folks,
I am trying to get my head around coding a list based on query results and I'm
just not seeing it. I don't know if my approach is wrong and maybe I should be
using the listAppend() function or what. I have a query that grabs the values
from 4 fields that hold email addresses. The result set may or may not return a
value for each so I need to somehow account for those in building a final list
of email addresses that I can drop into the CC field in emails. Here's roughly
what I have thus far:
<cfquery name="getFormEmails" datasource="#dsdata3#">
SELECT * FROM tblrequesttypes
WHERE request_type = '#form.PageTitle#'
</cfquery>
<cfparam name="getFormEmails.cc_email1" default="" />
<cfparam name="getFormEmails.cc_email2" default="" />
<cfparam name="getFormEmails.cc_email3" default="" />
<cfparam name="getFormEmails.cc_email4" default="" />
This is the part that's making mush of my brain and has me stumped. In this
particular instance I get 2 out of 3 email addresses that are in the result set.
<cfif Len(getFormEmails.cc_email1)>
<cfset CCList = getFormEmails.cc_email1 />
<cfif getFormEmails.cc_email2 NEQ "">
<cfset CCList = #CCList# & "," & getFormEmails.cc_email2 />
<cfelse>
<cfif getFormEmails.cc_email NEQ "">
<cfset CCList = #CCList# & "," &
getFormEmails.cc_email3 />
<cfelse>
<cfif getFormEmails.cc_email4 NEQ "">
<cfset CCList = #CCList# & ","
& getFormEmails.cc_email4 />
<cfelse>
<cfset CCList = #CCList# & ","
& getFormEmails.cc_email3/>
</cfif>
</cfif>
<cfset CCList = getFormEmails.cc_email1 />
</cfif>
</cfif>
<cfoutput>#CCList#</cfoutput>
I know I'm probably making this more difficult than it really is but I just
cannot see the trees for the forest right now and your help is needed and much
appreciated!
Thanks!
Bob
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4832
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15