Why don't you just CFLOOP over the query? You don't need to convert
the query to a comma list to loop over it...

<CFLOOP query="qry_name")>
   ...cf code...
</CFLOOP>

Andrew.

----- Original Message -----
From: Mark Henderson <[EMAIL PROTECTED]>
Date: Thu, 23 Sep 2004 21:07:07 +1200
Subject: Converting query to comma separated list
To: CF-Talk <[EMAIL PROTECTED]>

My first question, though I suspect this might not be the best
approach . Is it possible to turn a query (cfdirectory in this case)
into a comma separated list?

The reason I ask is bcos currently I have a hardcoded list of folders
in my action file, and I loop through and pull all the files from
each. Like so...

<cfloop
   index = "thisItem"
   list = "maps,districtPlans,mgmtPlans">

<cfdirectory
   name="getAllFiles"
   action="">    directory="#serverdir##thisItem#"  
   sort="name ASC">

<cfquery dbtype="query" name="getAllFiles_#thisItem#">
   SELECT *  
   FROM getAllFiles
</cfquery>

</cfloop>

and in the display page something like...
<ol>
<cfoutput query="getAllFiles_maps">
#replace(listFirst(name), "_", " ", "ALL")#<br />
</cfoutput>
</ol>
<ol>
<cfoutput query="getAllFiles_mgmtPlans">
#replace(listFirst(name), "_", " ", "ALL")#<br />
</cfoutput>
</ol> etc etc
--------------------

This is all working fine. BUT, instead of hardcoding the list, I can
do another directory call like so...

<cfdirectory
name="getAllFolders"
action=""> directory="#serverdir#"
sort="name ASC">

which will give me all the folders that are in the above list (ie
maps,districtPlans etc). So, how to get the query to a list so I don't
need to hardcode? OR, is this the wrong approach and is it possible to
use the getAllFolders query directly in some fashion?

TIA
Mark________________________________
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to