[KCFusion] Uploading CSV
I need to upload a CSV file and enter its field values into a database. I can read the file and output it cffile destination=e:\WebSites\KCHost\Fax action=UPLOAD nameconflict=overwrite filefield=XFile cffile action=READ file=e:\WebSites\KCHost\Fax\#FILE.ServerFile# variable=RawFile cfquery datasource=enews name=Update INSERT INTO Fax (Name) VALUES('#RawFile#') /cfquery This puts into one field. But how can Read each field The fields would be Name, Faxnumber Rick Eidson
RE: [KCFusion] Uploading CSV
Rick, My apologies. Apparently Matt has done this particular code massaging before. Use his example, it is far easier and faster than my own impromtu solution. Ryan -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Jones, MattSent: Monday, June 11, 2001 2:55 PMTo: '[EMAIL PROTECTED]'Subject: RE: [KCFusion] Uploading CSV cfset EndLine = Chr(10) Chr(13) cfset listDelim = "," cfloop list="#RawFile#" index="CurData" delimiters="#EndLine#" !--- Name could be accessed by #listGetat(CurData,1,listDelim)# --- !--- Faxnumber could be accessed by #listGetat(CurData,2,listDelim)# --- !--- Put your insert query here --- /cfloop
Re: [KCFusion] Date Formats
Try #dateformat(datefield, mm/dd/)# Robin Krause Webmaster Central Missouri State University Conference Center 556 660.543.8487 [EMAIL PROTECTED] 06/11/01 04:03PM How would you all recommend that I deal with the output of a date field? I have a SQL database with a date field of type smalldatetime. However, when I output the value using CF, it looks like this: 2000-01-01 00:00:00. Is there an easy way to tell CF to format it like this without using JavaScript: 01/01/2001? Thank you all so much!! Jered __ The KCFusion.org list and website is hosted by Humankind Systems, Inc. List Archives http://www.mail-archive.com/cf-list@kcfusion.org Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED] To Subscribe mailto:[EMAIL PROTECTED] To Unsubscribe mailto:[EMAIL PROTECTED] __ The KCFusion.org list and website is hosted by Humankind Systems, Inc. List Archives http://www.mail-archive.com/cf-list@kcfusion.org Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED] To Subscribe mailto:[EMAIL PROTECTED] To Unsubscribe mailto:[EMAIL PROTECTED]
RE: [KCFusion] Date Formats
DateFormat functions in CF. If you are using doing any International display, use LSDateFormat. Cheers! Robin Greenhagen President/CEO GreenSoft Solutions, Inc. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, June 11, 2001 4:03 PM To: [EMAIL PROTECTED] Subject: [KCFusion] Date Formats How would you all recommend that I deal with the output of a date field? I have a SQL database with a date field of type smalldatetime. However, when I output the value using CF, it looks like this: 2000-01-01 00:00:00. Is there an easy way to tell CF to format it like this without using JavaScript: 01/01/2001? Thank you all so much!! Jered __ The KCFusion.org list and website is hosted by Humankind Systems, Inc. List Archives http://www.mail-archive.com/cf-list@kcfusion.org Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED] To Subscribe mailto:[EMAIL PROTECTED] To Unsubscribe mailto:[EMAIL PROTECTED] __ The KCFusion.org list and website is hosted by Humankind Systems, Inc. List Archives http://www.mail-archive.com/cf-list@kcfusion.org Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED] To Subscribe mailto:[EMAIL PROTECTED] To Unsubscribe mailto:[EMAIL PROTECTED]
[KCFusion] DateFormat
Hello. I'm a nerd. No sooner had I sent out my message, but I realized what a wonderful thing the Help package is that comes with CF. Thank you for your responses. Sorry for the premature cry for assistance. :) __ The KCFusion.org list and website is hosted by Humankind Systems, Inc. List Archives http://www.mail-archive.com/cf-list@kcfusion.org Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED] To Subscribe mailto:[EMAIL PROTECTED] To Unsubscribe mailto:[EMAIL PROTECTED]
Re: [KCFusion] Uploading CSV
Be VERY CAREFUL with this code, because CF "eats" multiple contiguous delimiters. ListLen("foo,bar,candy") is 3, but ListLen("foo,,candy") is *2*, and ListGetAt("foo,,candy",3) will return an error. The last time I had to work with CSV files containing null values I did this: !--- For each row, parse the columns into an array: --- CFSET aThisRow = ArrayNew(1)CFLOOP List="#TheFile#" Index="CurRow" Delimiters="#crlf#"cfscript while (len(CurRow)) {tabPos = find(tab,CurRow);if (tabPos is 0) {aThisRow[CurCol]=CurRow;CurRow="";} else if (tabPos is 1) {aThisRow[CurCol]="";CurRow=mid(CurRow,2,len(CurRow));} else {aThisRow[CurCol]=left(CurRow,tabPos-1);CurRow=mid(CurRow,tabPos+1,len(CurRow));}CurCol=CurCol+1;} /cfscript !--- here i did the import based on the column number index into the array --- /CFLOOP HTH Daryl - Original Message - From: Jones, Matt To: '[EMAIL PROTECTED]' Sent: Monday, June 11, 2001 2:55 PM Subject: RE: [KCFusion] Uploading CSV cfset EndLine = Chr(10) Chr(13) cfset listDelim = "," cfloop list="#RawFile#" index="CurData" delimiters="#EndLine#" !--- Name could be accessed by #listGetat(CurData,1,listDelim)# --- !--- Faxnumber could be accessed by #listGetat(CurData,2,listDelim)# --- !--- Put your insert query here --- /cfloop -Original Message-From: Rick Eidson [mailto:[EMAIL PROTECTED]]Sent: Monday, June 11, 2001 2:44 PMTo: KCCFUG ([EMAIL PROTECTED])Subject: [KCFusion] Uploading CSV I need to upload a CSV file and enter its field values into a database. I can read the file and output it cffile destination="e:\WebSites\KCHost\Fax" action="UPLOAD" nameconflict="overwrite" filefield="XFile" cffile action="READ" file="e:\WebSites\KCHost\Fax\#FILE.ServerFile#" variable="RawFile" cfquery datasource="enews" name="Update" INSERT INTO Fax (Name) VALUES('#RawFile#') /cfquery This puts into one field. But how can Read each field The fields would be Name, Faxnumber Rick Eidson