Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading CSV Fields w/out names

Status
Not open for further replies.

tyrant1969

Programmer
Dec 13, 2004
68
US
We are in the process of creating a lookup utility based on a CSV file that we get dumped to our CF server from one of our primary apps.

The output options are extremely limited, especially for cross functionality with CF. Unfortunately, the best file type (as mentioned above) is CSV, but the application just dumps raw data - no field headers in it at all.

Our upper management has insisted that the process be automated - ie no manual editing of the file to include field names.

We know what the data elements in each section of the CSV are going to be, we just cannot access them without the field names.

Is there a way to access each field of a CSV by some kind of a raw name? IE field1, field2, etc?
 
are the field names seperated by tab ?
if you the headers are always on the very first line, then you can


<cfloop list="#myFile#" index="curLine" delimiters="#chr(10)##chr(13)#">
<cfloop index="k" list="#curLine#" delimiters="#chr(9)#">
#k#
</cfloop>
</cfloop>

for the very first line, the above code will give you the field names.
hope it helps...




 
The problem is that the data dump we get apparently cannot put a field name row into the CSV.

The first row of the csv is actually part of the data file.
 
We suggested that very solution, but upper management wants an "automated" solution requiring no human intervention. The data dump will be automatically FTP'd from the app server to the CF server and they want it completely "hands off".

We are also investigating whether the person who wrote the data dump did it right. I'm hoping that someone else could do it better and eliminate this issue.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top