Is or was it the quotes 

<cffile
 action="append"
 file="#tempfile#"
 output="<cfloop list=" <------ ???

-Dan


-----Original Message-----
From: Doug Hyde [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 02, 2005 8:28 PM
To: CF-Talk
Subject: Questions on a dynamic tab delimited export and regular expressions

Help please...

I am trying to create a little custom tag that allows someone to query a
database, and then (if they decide) have the results of the query sent to
them as a tab delimited file by email. The user can select any number of
fields. The data is in sql server, and some of it is in ntext columns, and
in some cases has tabs in it (commas won't work...more commas than tabs).

So, I have two challenges. First, because the user can select any of the
fields they want, I don't always know what the column names are ahead of
time. To resolve this for column headings in the export file, I created a
tab-delimited list based on query.columnlist. However, it gets tricky for
the actual data...I loop through the query, and append each value. What I
need to do is run a regular expression inside this loop...but I am not sure
how to (1) dynamically generate the variable from the query based on and (2)
run a regular expression on any ntext fields to remove returns.....here is
my code - throws an error at output in cffile (doesn't like the loop). The
loop works fine out of the cffile tag. Any thoughts?

<cfoutput query="getData">

<cffile
 action="append"
 file="#tempfile#"
 output="<cfloop list="#getData.columnList#" index="i">
                <cfif findnocase('mem',i)>
                        <cfset temp =
rereplace(setvariable(i,#evaluate('getData.'&i)#),replacethis,replacewith)&c
hr(9)>
                <cfelse>
                        <cfset temp =
setvariable(i,#evaluate('getData.'&i)#)&chr(9)>
                </cfif>
                <cfoutput>#temp#</cfoutput>
        </cfloop>"
 addnewline="Yes">

</cfoutput>

Thanks.

D




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197313
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to