Eric:

Remove the CFOUTPUT tags from your CFHTTP tag.  The CFHTTP code should look
like:

<cfhttp
url=""> at=sc1l1&ext=.csv"
        method="GET"
        name="qStockItems"
        columns="Symbol,Change,LastTradedPrice"
        textqualifier=""
        delimiter=","
        firstrowasheaders="no">

You never use CFOUTPUT inside of an attribute value.  If you want the value
to be dynamic (or partially dynamic), you would use code like:

attr = "value"
attr = variable
attr = "value #variable# value"

Note the pound signs in the last example.  The CFOUTPUT tag is not needed,
nor is it valid in this context.

--
Mosh Teitelbaum
evoch, LLC
Tel: (301) 942-5378
Fax: (301) 933-3651
Email: [EMAIL PROTECTED]
WWW: http://www.evoch.com/

-----Original Message-----
From: Eric Creese [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 29, 2004 11:21 AM
To: CF-Talk
Subject: CFHTTP Help needed

The code I originally wrote has morphed into the following with some help
from others on the list. However I am getting an error. It seems to not like
the attribute variable for the query. One other thing. The URL from Yahoo
seems to like the symbols to be separated with a + sign and my code is not
providing that but there does not appear to be an error because of it. Any
help would be appreciated

Here is the error:
Attribute validation error for tag cfloop. The value of the attribute query,
which is currently "qStockItems", is invalid. The Error Occurred in
C:\CFusionMX\wwwroot\stock3.cfm: line 21
19 :
20 : <!--- loop over the query from the cfhttp feed. --->
21 : <cfloop query="qStockItems">

Here is the code:

<!--- get all the symbols from the database --->
<cfquery name="qGetSymbols" datasource="stocks">
SELECT  sym
FROM  symbols
WHERE  exchg ='NYSE'
</cfquery>

<!--- get a list of all the symbols --->
<cfset lStockSymbols = valueList( qGetSymbols.sym )/>
<cfoutput>#lStockSymbols#</cfoutput><br>
<!--- get the symbols from the yahoo feed --->
<cfhttp
url=""> bols#</cfoutput>&format=sc1l1&ext=.csv"
        method="GET"
        name="qStockItems"
        columns="Symbol,Change,LastTradedPrice"
        textqualifier=""
        delimiter=","
        firstrowasheaders="no">

<!--- loop over the query from the cfhttp feed. --->
<cfloop query="qStockItems">

<!--- and if the last traded price of this row isnt zero  --->

<CFIF qStockItems.LastTradedPrice NEQ 0.00>
  <!--- insert this row into the database  --->
     <cfquery name="qInsertStock" datasource="stocks">
    INSERT INTO stocks
      (Symbol,Change)
    VALUES
      ('#qStockItems.Symbol#','#qStockItems.Change#')
     </cfquery>
</CFIF>
</cfloop>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to