Neal,
 
    ListAppend() should do what you need.  Just create a new, empty list before you start your first loop.
 
    Eric
-----Original Message-----
From: Bailey, Neal [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 17, 2004 4:58 PM
To: [EMAIL PROTECTED]
Subject: RE: All Loopy over Loops - Need Help

Hi Eric,

 

I understand what you're saying about looping a query this way and I know it's not a preferred method. But the first loop will only contain 4 elements max and will never change. Most of the time it will only contain one variable.

 

Just to give you an overview. This is a type of email system that grabs a group of emails, like Divisions, Regions and Districts. I use the first loop to loop through a query to match up the list with its field that contains part of a query statement for the particular group that has looped. Then I need to take all the contents of that field (which are Query Statements) and store them in another coma delimited list.

 

Then I take the list of "Query statements" and run it through a loop again which runs the query and builds the email list for that group and sends the emails to the queue.

 

I know this sounds kind of funky doing this way, but there is a lot more that's going on at the same time as this whole system is also connection to our exchange server.

 

So really all I need to do is build a second list from the results of the first loop that just ran. But I can't figure out how to build the second list. All I gets is the last results of the first loop.

 

Thanks...

 

Neal Bailey


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Knipp, Eric
Sent: Wednesday, November 17, 2004 4:08 PM
To: '[EMAIL PROTECTED]'
Subject: RE: All Loopy over Loops - Need Help

 

 

    Neal,

 

    The way your example is written, you will be doing one query for each item in the list.  Even with a list as small as the one in the example, you would want to avoid this; I can only imagine how long your template would take to execute if you did this with a much larger list.

 

    My suggestion is that instead of executing one query for each list item, you append part of the WHERE clause to a string variable containing your SQL.  Then you can execute that SQL within your <cfquery>, getting all of the results in a single query that you can loop over afterwards.  In the loop following the query, snag the e-mail address and ListAppend() it into a new list.

 

    Hope this helps,

 

    Eric

-----Original Message-----
From: Bailey, Neal [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 17, 2004 3:59 PM
To: [EMAIL PROTECTED]
Subject: All Loopy over Loops - Need Help

Hey guys...

 

Man I am stuck in a loop...

 

I have this query that I need to loop through and then somehow pull data out of the query and append it to another comma delimited list. Any ideas on how I would go about this. Its got my all loopy.

 

Here is kind of an example of what I am trying to do:

------------------------------------------------------------------

<cfset list = "John, Mike, Luke">

 

<cfloop index="EmailList" list="#list#" delimiters=",">

<cfquery name="GetGroupQ" datasource="DSN">

SELECT *

FROM EmailSystem_Groups

WHERE GroupName = '#EmailList#'

</cfquery>

</cfloop>

------------------------------------------------------------------

 

Ok so I loop through the query to get their email address, but I want to also insert or append the email address into another list like:

 

SESSION.EmailList = "[EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]"

 

...because later on I run this list through another loop process.

 

This is just an example. Its not even email data that I'm pulling.

 

Hopefully this makes sense.

 

Thanks...

Neal Bailey


CONFIDENTIALITY NOTICE: The information contained in this e-mail and attached document(s) may contain confidential information that is intended only for the addressee(s). If you are not the intended recipient, you are hereby advised that any disclosure, copying, distribution or the taking of any action in reliance upon the information is prohibited. If you have received this e-mail in error, please immediately notify the sender and delete it from your system.


CONFIDENTIALITY NOTICE: The information contained in this e-mail and attached document(s) may contain confidential information that is intended only for the addressee(s). If you are not the intended recipient, you are hereby advised that any disclosure, copying, distribution or the taking of any action in reliance upon the information is prohibited. If you have received this e-mail in error, please immediately notify the sender and delete it from your system.

Reply via email to