Thanks Scott.  Not talking about a lot of data so a simple CFfile should 
do.

Brian

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

From: "Scott Thornton" <scott.thorn...@hnehealth.nsw.gov.au>
Sent: Tuesday, May 13, 2014 3:21 PM
To: "cfaussie@googlegroups.com" <cfaussie@googlegroups.com>
Subject: RE: [cfaussie] Dynamic Data source



Hi,
 
You could read the .csv line by line, using CFFILE , but it can be pretty 
slow.
 
( There are probably fancier\faster ways )
 
Eg.
 
<!--- get a list of csv files --->
<cfdirectory 
                action="List"
                directory="mydirectory"
    name="myfiles"
                filter="*.csv">
                
<!--- loop over each .csv file --->                               
<cfloop query="myfiles">
 
                <cffile action="READ" file="mydirectory\#myfiles.Name#" 
variable="FileText">
                
                <cfloop index="my_current_file_record"
                list="#FileText#"
                delimiters="#Chr(13)##Chr(13)##Chr(10)#">
                
                                <!--- Put Spaces between commas, or 
coldfusion thinks that there is only 1 --->
                                <cfset my_current_file_record = 
REPLACE(my_current_file_record, ",,", ", ,", "ALL")>
                                <cfset my_current_file_record = 
REPLACE(my_current_file_record, ",,", ", ,", "ALL")>
                                
                                <cfset column1 = listgetAt( 
my_current_file_record ,1, ',')>
                                <cfset column2 = listgetAt( 
my_current_file_record ,2, ',')>
 
                etc                                                         
 
                
                </cfloop>
 
</cfloop>
 




-- 
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To unsubscribe from this group and stop receiving emails from it, send an 
email to cfaussie+unsubscr...@googlegroups.com.
To post to this group, send email to cfaussie@googlegroups.com.
Visit this group at http://groups.google.com/group/cfaussie.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cfaussie+unsubscr...@googlegroups.com.
To post to this group, send email to cfaussie@googlegroups.com.
Visit this group at http://groups.google.com/group/cfaussie.
For more options, visit https://groups.google.com/d/optout.

Reply via email to