why not just grab an existing java lib which supports CSV? like http://supercsv.sourceforge.net/ or something?
On Wed, Sep 10, 2008 at 5:15 PM, Andrew Scott <[EMAIL PROTECTED]>wrote: > > Ok that doesn't work for me. > > > > -- > Senior Coldfusion Developer > Aegeon Pty. Ltd. > www.aegeon.com.au > Phone: +613 9015 8628 > Mobile: 0404 998 273 > > > > > -----Original Message----- > From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On > Behalf > Of Steve Onnis > Sent: Wednesday, 10 September 2008 4:41 PM > To: cfaussie@googlegroups.com > Subject: [cfaussie] Re: Quick List question > > > You didn't know that.... > > <cfhttp url="csvfile.txt" name="csvQry"></cfhttp> > > ...will return to you a query object based on the csv data in the file? > > Try this for an example. Just save it to a file and run it. > > <cfsetting enablecfoutputonly="Yes" showdebugoutput="No" /> > <cfif structKeyExists(URL, "docsv")> > <cfset csvdata = "List Item ##1, List Item ##2, ""inner List Item ##1, > inner > List Item ##2"", List Item ##4" /> > <cfoutput>#csvdata#</cfoutput> > <cfelse> > <cfhttp url="http://#server_name#/#script_name#?docsv=true" name="myCSV" > firstrowasheaders="No"></cfhttp> > <cfdump var="#myCSV#"> > </cfif> > > > It outputs a query object with 1 row in it with the csv data in tact. From > there you can just loop over the query and do what you want to do with the > data. > > Easy enough for you? > > Steve > > -----Original Message----- > From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On > Behalf > Of Andrew Scott > Sent: Wednesday, 10 September 2008 4:27 PM > To: cfaussie@googlegroups.com > Subject: [cfaussie] Re: Quick List question > > > Steve, > > How do you get it to a query, when the list function is broken? Can you > explain that more? > > However, I personally am not interested in a solution. It has been > completed, it is something that I feel should work differently. > > I would prefer to look elsewhere when ColdFusion is like this, a java > object > in CF works wonders too you know!!! And you have all the list append etc, > so > why is ColdFusion different is the real question I am asking:-) > > > > -- > Senior Coldfusion Developer > Aegeon Pty. Ltd. > www.aegeon.com.au > Phone: +613 9015 8628 > Mobile: 0404 998 273 > > > > > -----Original Message----- > From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On > Behalf > Of Steve Onnis > Sent: Wednesday, 10 September 2008 4:23 PM > To: cfaussie@googlegroups.com > Subject: [cfaussie] Re: Quick List question > > > Do a CFHTTP, get it into a query recordset and loop over the query to > rebuild your CSV. At least this way you have the data in a format that is > going to be easier to work with than trying to loop over a file. > > From what I can see you are making something that can be done pretty easy > into a nightmare for yourself. > > Steve > > -----Original Message----- > From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On > Behalf > Of Andrew Scott > Sent: Wednesday, 10 September 2008 4:18 PM > To: cfaussie@googlegroups.com > Subject: [cfaussie] Re: Quick List question > > > Ok first of all this is a one of conversion for an excel spreadsheet (CSV > saved), secondly who said anything about recordsets? > > All I need to do is open the csv, read it line by line and recreate the csv > taking the quotes from around a list item and expand that into another csv. > It is 100% file based, a cfhttp is not going to work (At least I don't see > how) and secondly as it is a once of the problem has already been done in > Java. The question I have is why could I not do it ColdFusion? Without > &^%$#@'ing around, and still not get it to work? > > Java/Groovy/.Net no problem, ColdFusion massive problem. > > I have flagged it for discussion in the relevant area, so we'll see what > the > development team now say. It has been version 5 since I last needed to do > something, I am just annoyed that it is still an issue 3 versions +1 later. > > > > -- > Senior Coldfusion Developer > Aegeon Pty. Ltd. > www.aegeon.com.au > Phone: +613 9015 8628 > Mobile: 0404 998 273 > > > > > -----Original Message----- > From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On > Behalf > Of Steve Onnis > Sent: Wednesday, 10 September 2008 4:04 PM > To: cfaussie@googlegroups.com > Subject: [cfaussie] Re: Quick List question > > > Why don't you put the file somewhere and do a CFHTTP on it and create the > recordset like that? > > -----Original Message----- > From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On > Behalf > Of Barry Beattie > Sent: Wednesday, 10 September 2008 3:58 PM > To: cfaussie@googlegroups.com > Subject: [cfaussie] Re: Quick List question > > > Andrew, I'm curious > > is it just the ListGetAt(position) function that's the grief? it might be > "broken" itself > > I wonder if all list functions are similarly broken: if you convert your > list to an array with ListToArray(list) first would you get the correct 4 > items or incorrect 6 items? > > > > > > > On Wed, Sep 10, 2008 at 3:45 PM, Brett Payne-Rhodes <[EMAIL PROTECTED]> > wrote: > > > > I don't think list processing is clever enough to say "Ignore delimiters > that are inside double quotes" so it treats the comma inside your 'third' > element as a valid delimiter. > > > > You might have to run a clever bit of regex to replace said commas before > the list processing and once you have the element then simply restore the > commas. > > > > Someone cleverer than me will need to provide the regex though... :) > > > > > > B) > > > > > > Andrew Scott wrote: > >> Scott, > >> > >> Cheers but I don't see how that helps, I am aware of how empty lists > >> are handled. The problem lies in this example > >> > >> List Item #1, List Item #2, "inner List Item #1, inner List Item #2", > >> List Item #4 > >> > >> This is for all intent and purposes only 4 items. Yet ColdFusion sees > >> this as 6!! > >> > >> I know that this has popped up many times, and when you need it do > >> you think google is helping? > >> > >> So ListGetAt(myList,4) > >> > >> Returns > >> > >> Inner List Item #2 when it clearly should be List Item #4 > >> > >> > >> > > > > -- > > Brett Payne-Rhodes > > Eaglehawk Computing > > t: +61 (0)8 9371-0471 > > m: +61 (0)414 371 047 > > e: [EMAIL PROTECTED] > > w: http://www.yoursite.net.au > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- Zac Spitzer - http://zacster.blogspot.com (My Blog) +61 405 847 168 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "cfaussie" group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en -~----------~----~----~----~------~----~------~--~---