Adobe Dreamweaver Forums



Last 10 THreads :         Format numbers with leading zeros (Last Post : charlie656 - Replies : 0 - Views : 1 )           »          Event listener (Last Post : lammspillning - Replies : 2 - Views : 3 )           »          action script for button (Last Post : NedWebs - Replies : 5 - Views : 10 )           »          403 error from my domain? (Last Post : Ken Ford - *ACE* - Replies : 1 - Views : 4 )           »          Adding database RDS Login Dreamweaver 8 Coldfusion 8 (Last Post : ClubbyJMC2008 - Replies : 4 - Views : 5 )           »          Looping from end of clip to middle of clip (Last Post : Gibbah - Replies : 1 - Views : 5 )           »          Help need div to expand to height of browser (Last Post : Tim G - Replies : 1 - Views : 2 )           »          how do I add a table to a preformed template that I got? (Last Post : mb007inc - Replies : 0 - Views : 1 )           »          Downloading from Flash (Last Post : NedWebs - Replies : 1 - Views : 2 )           »          Checking which button is clicked (Last Post : NedWebs - Replies : 3 - Views : 4 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Cold Fusion
 
Tags:



Reply
  #1 (permalink)  
Old 10-09-2008, 05:51 PM
trojnfn
 
Posts: n/a
Diggs:
Default valuelist question

My table contains a supplier number and email address. I can have multiple
email addresses for each suppliernumber. I want to group all the emails
together into one string so cfmail can send to the entire string instead of
individually, so I try to use valuelist to do this. Seems to work, but my
question is how do I separate each list by the supplier number ? I tried to use
group by in the queyr and it does not work.

So if supplier 1 has 3 records (email) and supplier 2 has 5 records (email),
my oput should be two records only, for supplier 1 with eamail 1,2,3, etc. and
supplier 2 with email 1, 2,3, 4, 5. etc.

How can I do this ?



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 10-09-2008, 06:14 PM
Ian Skinner
 
Posts: n/a
Diggs:
Default Re: valuelist question

trojnfn wrote:
>
> How can I do this ?
>


Well that is going to take a couple of steps.

If you look at valueList() you will see that it returns a list of all
the values from a column in a record set.

You currently have a record set that contains all the emails for all the
suppliers. The emails are grouped by supplier, but the record set still
contains all of them.

Obviously somewhere in between you need to break this single record set
into multiple groups of records. One group for each supplier with all
that suppliers e-mails.

I can think of three different ideas off the top of my head. Each with
different pros and cons.

Repeatedly query the database for each supplier.

Query the database for all the suppliers and use Query of Query
functionality to break up this large record set into smaller record sets.

Query the database for all the suppliers, use <cfoutput...> with its
group parameter to loop over this record set. Building the email list
as it loops, and then outputting an email after all the emails for a
single supplier are listed.

<cfoutput query="myQuery" group="supplier">
<cfset emailList = "">
<cfoutput>
<cfset emailList = ListAppend(emailList,myQuery.supplier_email)>
</cfoutput>
<cfmail to="#emailList#"...>
</cfmail>
</cfoutput>

Reply With Quote
  #3 (permalink)  
Old 10-09-2008, 06:14 PM
Dan Bracuk
 
Posts: n/a
Diggs:
Default Re: valuelist question

Try something like this:

<cfoutput query="q1" group = "suppliernumber">
<cfquery name = "q2" dbtype = "query">
select email
from q1
where suppliernumber = #suppliernumber#

<cfmail to = "#valuelist(q2.email)#">

Reply With Quote


Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 01:26 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk