Re: CSV file and com.Ostermiller.util.ExcelCSVParser
Yes, I know and it works except if the empty fields are at the of the line and then not all the time. You can try it yourself. Export your contacts from outlook to a csv file and try to import it using the code that I have posted. You will see that it will complain that certain lines (array returned) have less than 92 elements (the number of fields exported by outlook). I got around it by putting a number of try catch error trapping when importing Thanks Victor PS Maybe I will try to On Apr 6, 2005 11:02 PM, Jon Gunnip [EMAIL PROTECTED] wrote: Victor, The docs at http://ostermiller.org/utils/doc/com/Ostermiller/util/ExcelCSVParser.html explicitly state that the parser should work as you expect: quote Empty fields are returned as as String of length zero: . The following line has three empty fields and three non-empty fields in it. There is an empty field on each end, and one in the middle. One token is returned as a space. ,second,, ,fifth, /quote A few things I might try if I were you: 1) try and reproduce the problem with as simple an example as possible (e.g. Parser.parse(a,,b) ) 2) write some simple java to try to reporoduce a simple example 3) if both of the above still reproduce the broblem, you could ask mr. ostermiller to fix the problem and maybe you can workaround it by using a regex on the empty string to add a rare string to empty cells prior to parsing and then remove it after parsing 4) if you can't reproduce the problem with a simple string, keep adding to it until it looks more like your CSV and fails. Good luck. Sorry I couldn't be of more help. I'd be interested to hear what you find. Jon On Apr 4, 2005 6:10 PM, Victor Moore [EMAIL PROTECTED] wrote: Hi Jon, I'm happy with this utility , except this little problem. Bellow is the code: cfscript parser = createObject(java, com.Ostermiller.util.ExcelCSVParser) ; fileInfo = parser.parse(fileContents) ; noFields = arrayLen (fileInfo); for (i = 2; i lte noFields; i = i + 1) { lineArray = fileInfo [i]; initSize = arrayLen (lineArray); if (initSize lt 30) { msg = Error...; } } /cfscript I know that there are 30 fields in the file. If I open the file in Excel I can see all of them there, but some of them have no value and this is why the checking bombs. If I run a replace all in excel and replace the empty fields with a space everything is OK and the file parsing works as expected. ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:201962 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=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CSV file and com.Ostermiller.util.ExcelCSVParser
Victor, The docs at http://ostermiller.org/utils/doc/com/Ostermiller/util/ExcelCSVParser.html explicitly state that the parser should work as you expect: quote Empty fields are returned as as String of length zero: . The following line has three empty fields and three non-empty fields in it. There is an empty field on each end, and one in the middle. One token is returned as a space. ,second,, ,fifth, /quote A few things I might try if I were you: 1) try and reproduce the problem with as simple an example as possible (e.g. Parser.parse(a,,b) ) 2) write some simple java to try to reporoduce a simple example 3) if both of the above still reproduce the broblem, you could ask mr. ostermiller to fix the problem and maybe you can workaround it by using a regex on the empty string to add a rare string to empty cells prior to parsing and then remove it after parsing 4) if you can't reproduce the problem with a simple string, keep adding to it until it looks more like your CSV and fails. Good luck. Sorry I couldn't be of more help. I'd be interested to hear what you find. Jon On Apr 4, 2005 6:10 PM, Victor Moore [EMAIL PROTECTED] wrote: Hi Jon, I'm happy with this utility , except this little problem. Bellow is the code: cfscript parser = createObject(java, com.Ostermiller.util.ExcelCSVParser) ; fileInfo = parser.parse(fileContents) ; noFields = arrayLen (fileInfo); for (i = 2; i lte noFields; i = i + 1) { lineArray = fileInfo [i]; initSize = arrayLen (lineArray); if (initSize lt 30) { msg = Error...; } } /cfscript I know that there are 30 fields in the file. If I open the file in Excel I can see all of them there, but some of them have no value and this is why the checking bombs. If I run a replace all in excel and replace the empty fields with a space everything is OK and the file parsing works as expected. ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:201816 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=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
CSV file and com.Ostermiller.util.ExcelCSVParser
I am using com.Ostermiller.util.ExcelCSVParser with great succes to parse csv files. There is only one small problem that I can't figure out.If there are any empty columns in the file they are not picked up and as a result the parsing process is failing. The work around is to open the file in excel and run a replace all (for empty string with a space). Unfortunately this is used by end users and for some reason they don't do it ... Is any way to do it programmatically? Thanks Victor ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:201350 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
RE: CSV file and com.Ostermiller.util.ExcelCSVParser
this will probably be because CF ignores empty list elements. there might be some kind of a split function on cflib.org -Original Message- From: Victor Moore [mailto:[EMAIL PROTECTED] Sent: 04 April 2005 15:14 To: CF-Talk Subject: CSV file and com.Ostermiller.util.ExcelCSVParser I am using com.Ostermiller.util.ExcelCSVParser with great succes to parse csv files. There is only one small problem that I can't figure out.If there are any empty columns in the file they are not picked up and as a result the parsing process is failing. The work around is to open the file in excel and run a replace all (for empty string with a space). Unfortunately this is used by end users and for some reason they don't do it ... Is any way to do it programmatically? Thanks Victor ~| 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:201351 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
Re: CSV file and com.Ostermiller.util.ExcelCSVParser
Actually it's a little bit more complicated than this. The com.Ostermiller.util.ExcelCSVParser utility returns a Java array which is has a Vector type and not the coldfusion array type. Unfortunately (and something that I cannot explain) some lines that have empty fields are not pick up. I need something to dynamically resize the java array (the java array doesn't have a resize feature to force ) or cast it to a cf array type. thanks Victor On Apr 4, 2005 10:36 AM, Kerry [EMAIL PROTECTED] wrote: this will probably be because CF ignores empty list elements. there might be some kind of a split function on cflib.org -Original Message- From: Victor Moore [mailto:[EMAIL PROTECTED] Sent: 04 April 2005 15:14 To: CF-Talk Subject: CSV file and com.Ostermiller.util.ExcelCSVParser I am using com.Ostermiller.util.ExcelCSVParser with great succes to parse csv files. There is only one small problem that I can't figure out.If there are any empty columns in the file they are not picked up and as a result the parsing process is failing. The work around is to open the file in excel and run a replace all (for empty string with a space). Unfortunately this is used by end users and for some reason they don't do it ... Is any way to do it programmatically? Thanks Victor ~| 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:201417 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=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CSV file and com.Ostermiller.util.ExcelCSVParser
Victor, I'm using the ostermiller CSVWriter, and I am very happy with it. I'm having trouble understanding exactly what your problem is. Can you share some relevant code? Jon On Apr 4, 2005 12:58 PM, Victor Moore [EMAIL PROTECTED] wrote: Actually it's a little bit more complicated than this. The com.Ostermiller.util.ExcelCSVParser utility returns a Java array which is has a Vector type and not the coldfusion array type. Unfortunately (and something that I cannot explain) some lines that have empty fields are not pick up. I need something to dynamically resize the java array (the java array doesn't have a resize feature to force ) or cast it to a cf array type. thanks Victor On Apr 4, 2005 10:36 AM, Kerry [EMAIL PROTECTED] wrote: this will probably be because CF ignores empty list elements. there might be some kind of a split function on cflib.org -Original Message- From: Victor Moore [mailto:[EMAIL PROTECTED] Sent: 04 April 2005 15:14 To: CF-Talk Subject: CSV file and com.Ostermiller.util.ExcelCSVParser I am using com.Ostermiller.util.ExcelCSVParser with great succes to parse csv files. There is only one small problem that I can't figure out.If there are any empty columns in the file they are not picked up and as a result the parsing process is failing. The work around is to open the file in excel and run a replace all (for empty string with a space). Unfortunately this is used by end users and for some reason they don't do it ... Is any way to do it programmatically? Thanks Victor ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:201450 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=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CSV file and com.Ostermiller.util.ExcelCSVParser
Hi Jon, I'm happy with this utility , except this little problem. Bellow is the code: cfscript parser = createObject(java, com.Ostermiller.util.ExcelCSVParser) ; fileInfo = parser.parse(fileContents) ; noFields = arrayLen (fileInfo); for (i = 2; i lte noFields; i = i + 1) { lineArray = fileInfo [i]; initSize = arrayLen (lineArray); if (initSize lt 30) { msg = Error...; } } /cfscript I know that there are 30 fields in the file. If I open the file in Excel I can see all of them there, but some of them have no value and this is why the checking bombs. If I run a replace all in excel and replace the empty fields with a space everything is OK and the file parsing works as expected. ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:201457 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=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
CSV file and com.Ostermiller.util.ExcelCSVParser
I am using com.Ostermiller.util.ExcelCSVParser with great succes to parse csv files. There is only one small problem that I can't figure out.If there are any empty columns in the file they are not picked up and as a result the parsing process is failing. The work around is to open the file in excel and run a replace all (for empty string with a space). Unfortunately this is used by end users and for some reason they don't do it ... Is any way to do it programmatically? Thanks Victor ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:201252 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