Your trying to do to many loops. Try this and let me know if works for you.
<CFLOOP INDEX="get_count"
LIST="#form.notify#"
>
<CFQUERY NAME="notify_email" DATASOURCE="iMIS Enterprise">
SELECT Users.UserName
FROM Users Users
WHERE (Users.UserId='#form.NOTIFY#')
</cfquery>
<cfset Dear = Users.Username>
<!--- <CFMAIL FROM="[EMAIL PROTECTED]"
TO="#form.notify#@dineout.org"
SUBJECT="Help Desk Request for Follow-up"
SERVER="mail.dineout.org">
Dear #Dear# <!--- this doesn't work right, just yet -- but it will --->
</cfloop>
Sincerely,
Matthew M. Eschenbaum
Allaire Certified Professional
DevTech Inc.
[EMAIL PROTECTED]
206.956.0888
www.dev-tech.com
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 25, 2001 3:45 PM
To: CF-Talk
Subject: using variable list from a multiple select/form (warning: long)
Hello all,
I am having trouble using a particular variable. This is a long email
because I am trying to provide enough information to give a clear picture of
my problem (which is probably quite simple and I probably should be able to
solve it on my own ...)
I have a form variable (called "NOTIFY") which comes from a drop-down option
(dynamically populated) which allows for multiple choices. The variable
arrives on the action page (where the data is inserted in a table, that
works
no problem) as a comma delimited list. Once it arrives at the action page,
it
serves two functions. It's email address creation function works
beautifully. But then I need to use it to query our membership database to
pull out the actual name of the person so that the email message is more
user
friendly ... (the CN in an email address just won't do for Dear ____, you
know how that goes).
What I think I need to do it
1. Count the number of items in the list
2. Run it through a list loop to parse each item out as a separate variable
3. Run the query to the membership database to get the UserNames, using the
newly created variables.
4. Run it through a query to put it back in a new variable for output in the
single email that is generated.
But I don't know how to count the items or run the list loop. Can you help
me?
Here's the code for the select from the form, populated by an earlier query:
<SELECT NAME="NOTIFY"
SIZE="8"
MULTIPLE>
<CFOUTPUT QUERY="notify">
<OPTION VALUE=#NOTIFY#>#NOTIFY#
</cfoutput>
<OPTION VALUE=" ">No Report
</SELECT>
And this is what I have in the action form, so far:
<!--- First, test to see if the call taker has chosen to notify anyone. If
no notification targets have been selected, the CFMAIL tag will be skipped.
--->
<CFIF IsDefined('form.NOTIFY')>
<!--- Query to convert NOTIFY from the iMIS UserID to the UserName for a
more
user-friendly message in the email --->
<CFLOOP INDEX="get_count"
LIST="#form.notify#"
DELIMITERS=",">
</CFLOOP>
<CFOUTPUT>
#get_count.RecordCount#
</CFOUTPUT>
<CFSET to=#get_count.RecordCount#)
<CFLOOP INDEX="notify_emal"
FROM="1"
TO="#to#">
<CFQUERY NAME="notify_email" DATASOURCE="iMIS Enterprise">
SELECT Users.UserName
FROM Users Users
WHERE (Users.UserId='#form.NOTIFY#')
</cfquery>
</CFLOOP>
<CFSET Dear=" ">
<CFLOOP QUERY="who_to_notify">
<CFSET Dear=ListAppend(Dear, '#who_to_notify.UserName#')>
</CFLOOP>
<!--- Loops over CFMAIL tag so that multiple email recipients can be
inserted
--->
<CFLOOP INDEX="Notify_whom"
LIST="Notify"
DELIMITERS=","> (closes at the end of the mail, I have not included
all of that...)
<!--- Mails follow-up request/notification to all selected staff members,
based on iMIS UserID selected in the "users/NOTIFY" field of the form --->
<!--- <CFMAIL FROM="[EMAIL PROTECTED]"
TO="#form.notify#@dineout.org"
SUBJECT="Help Desk Request for Follow-up"
SERVER="mail.dineout.org">
Dear #Dear# <!--- this doesn't work right, just yet -- but it will --->
@@@@@@@
Help!!
Special thanks in advance to anyone who has a better idea of how to do this
than I have had so far.
:-)
Oriole
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists