Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>OK, I dumped the result and it looks like the CSV file is using <code>&lt;br&gt;</code> tags to denote a newline so you'll have to roll your own conversion. Here's an example that uses a UDF from <a href="http://cflib.org" rel="nofollow">cflib</a>:</p> <pre><code>&lt;cfscript&gt; /** * Transform a CSV formatted string with header column into a query object. * * @param cvsString CVS Data. (Required) * @param rowDelim Row delimiter. Defaults to CHR(10). (Optional) * @param colDelim Column delimiter. Defaults to a comma. (Optional) * @return Returns a query. * @author Tony Brandner (&amp;#116;&amp;#111;&amp;#110;&amp;#121;&amp;#64;&amp;#98;&amp;#114;&amp;#97;&amp;#110;&amp;#100;&amp;#110;&amp;#101;&amp;#114;&amp;#115;&amp;#46;&amp;#99;&amp;#111;&amp;#109;) * @version 1, September 30, 2005 */ function csvToQuery(csvString){ var rowDelim = chr(10); var colDelim = ","; var numCols = 1; var newQuery = QueryNew(""); var arrayCol = ArrayNew(1); var i = 1; var j = 1; csvString = trim(csvString); if(arrayLen(arguments) GE 2) rowDelim = arguments[2]; if(arrayLen(arguments) GE 3) colDelim = arguments[3]; arrayCol = listToArray(listFirst(csvString,rowDelim),colDelim); for(i=1; i le arrayLen(arrayCol); i=i+1) queryAddColumn(newQuery, arrayCol[i], ArrayNew(1)); for(i=2; i le listLen(csvString,rowDelim); i=i+1) { queryAddRow(newQuery); for(j=1; j le arrayLen(arrayCol); j=j+1) { if(listLen(listGetAt(csvString,i,rowDelim),colDelim) ge j) { querySetCell(newQuery, arrayCol[j],listGetAt(listGetAt(csvString,i,rowDelim),j,colDelim), i-1); } } } return newQuery; } &lt;/cfscript&gt; &lt;cfset u = "http://api.wunderground.com/weatherstation/WXDailyHistory.asp?ID=IHAMPSHI46&amp;month=3&amp;day=25&amp;year=2011&amp;format=1" /&gt; &lt;cfhttp url="#u#" result="csv" /&gt; &lt;!--- if you dump the result you can see that the result contains &lt;br&gt; tags to indicate new lines ---&gt; &lt;!--- &lt;cfdump var="#csv.fileContent#" /&gt; ---&gt; &lt;cfdump var="#csvToQuery(replace(csv.fileContent, "&lt;br&gt;", "", "all"))#" /&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload