Assuming that the file is delimited by chr(13):

Variables.myFile is the entire file....

<cfoutput>
<cfloop from="1" to="#listLen(Variables.myFile, chr(13))#" 
index="Variables.outerLoop">
        #Variables.outerLoop#:#listLen(listGetAt(Variables.myFile, 
Variables.outerLoop, chr(13)), ",")#<br />
</cfloop>
</cfoutput>

This should output each row number and how many comma delimited items are in 
that row.

Can't see I've ever seen a variable row length csv though.

Also, didn't test this so I could be wrong.

Steve


-----Original Message-----
From: Robert Harrison [mailto:[email protected]] 
Sent: Friday, October 08, 2010 12:02 PM
To: cf-talk
Subject: ListFunction Question


I have a CSV File of unknown length with an unknown number of columns. I
loop through the file and use 
#listgetAt('#index#',1,',')# to get the elements of the file, but I don't
know how many elements (columns) there are.

I'm trying to say only get an element if it exists, something like:

        <cfif
IsDefined(#listgetAt('#index#',23,',')#)>#listgetAt('#index#',23,',')#</cfif
>

But I'm not using the right isDefined argument. 

What should I be using?  

Or is there some way I can tell how many elements are in this list?


Robert B. Harrison
Director of Interactive Services
Austin & Williams
125 Kennedy Drive, Suite 100 
Hauppauge NY 11788
P : 631.231.6600 Ext. 119 
F : 631.434.7022
http://www.austin-williams.com 

Great advertising can't be either/or.  It must be &.

Plug in to our blog: A&W Unplugged
http://www.austin-williams.com/unplugged

 

__________ Information from ESET Smart Security, version of virus signature
database 5515 (20101008) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337992
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to