My text file (as it gets exported from MS Access) looks like this:
"FirstName","MiddleInitial","LastName"
"Matt","J","Jones"
"Steve",,"Smith"
Notice that the second record has no pair of double quotes because the MiddleInitial field was a null value for Steve Smith (he never entered his middle initial into the database and isn't required to).
My problem is that I'm trying to create a query object out of this text file using the following code and it won't work as it's coded:
<CFHTTP
DELIMITER=","
TEXTQUALIFIER=""""
METHOD="Get"
URL="http://#THISProviderURL#/providers/#Session.Auth.ProviderID#/batch/#BATCHFILENAME#";
NAME="GetUsersViaHTTP">
My problem is that since I don't have double quotes as the text qualifier in Steve's middle initial field the page bombs out saying "Incorrect Number of Columns"...meaning it's not able to read the file correctly I assume.
If I do a find and replace to make sure that all fields have double quotes no matter if they are null or not then the page processes just fine. I can't ask my users to do this procedure though.
I've tried everything...textqualifier=","...textqualifier=" ".... stripping out all double quotes from the text file. The only way I can get it to work is if all fields have double quotes.
Please helpppp!
Mike
<CFHTTP
DELIMITER=","
TEXTQUALIFIER=""""
METHOD="Get"
URL="http://#THISProviderURL#/providers/#Session.Auth.ProviderID#/batch/#BATCHFILENAME#";
NAME="GetUsersViaHTTP">
If so, I'm willing to try anything at this point. Also, I can follow your suggestion of not using quotes for the text qualifier. That shouldn't be a problem.
Mike
Why cant you use CFHTTP? If its because of the delimeter problem, you can still use it to just get the file contents (Which is what it does at its basic level). Take out any reference making it parse the file into a query, so you have:
<Cfhttp url="http://www.cftagstore.com/index.cfm" method="get"></cfhttp>
<cfset theHTMLReturnedByHTTP=cfhttp.fileContent>
Just retrive the file as text and work on parsing it that way using the method I suggested.
If on the other hand, the file is actually located on your server, just use CFFILE to read it into a variable and do the parsing then.
Dan.
Check Out : www.cftagstore.com for the latest and greatest Coldfusion custom tags and components!
Built by developers, for developers!
Claude Schnéegans, CS. Internétique
------------------------
See some cool custom tags
______________________________________