Jon,

Actually, what you are saying is not correct. Although it is better NOT
to use "reserved" words as variable names, in this case it will work.
The only problem in the code was prefixes. In the SQL, Mark should just
write
    '#variables.URL#',
and it should work.

When you use URL, CFMX will get the URL scope (this is a structure).
When you use variables.URL, CFMX will get the variable you created. If
you ALWAYS scope your variables, this kind of problems doesn't appear.
Of course, if you avoid using "reserved" words, this won't happen
either.

Pascal


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: maandag 1 september 2003 10:51
To: CF-Talk
Subject: Re: Convert Complex data to string error.


Monday, September 1, 2003, 12:51:27 AM, you wrote:
M> Hi Ike and Adam (and others),

M> I tried Ike's suggestion below but with the same outcome.

M>         <cfif session.basket.ProductURL EQ "">
M>                 <cfset URL = "">
M>         <cfelse>
M>                 <cfset URL = 
M> URLEncodedFormat(session.basket.ProductURL)>
M>         </cfif>

url is a reserved word. Any attempts to change it are ignored, so the
above code is essentially ignored.
http://livedocs.macromedia.com/coldfusion/6/Developing_ColdFusion_MX_App
lications_with_CFML/Elements15.htm

M>         <cfset thisStruct = URL> <!--- Did this just to keep the 
M> sample
simple  --->>
M>         <cfscript>
M>                 thisStructList = structKeyList(thisStruct);
M>                 thisString = "";
M>                 for(i = 1; i LTE listLen(thisStructList); i = i + 1)
M>                 {
M>                         thisString = listAppend(thisString, 
M> evaluate(listGetAt(thisStructList, i)));
M>                 }
M>         </cfscript>

This code, in and of itself will not error out. It will execute, just
not like you are expecting...I think. You attempt to set it to a string
in the first section, but then use structKeyList on it, so it's hard to
ascertain your goal here.

<snip>

M> <CFQUERY datasource="#dsn_orders#">
M> INSERT INTO
M>         tblInvoiceLineDetails 
M>         (
M>                 fldInvoiceID,
M>                 fldPartID,
M>                 fldPartNumber,
M>                 fldProductURL,
M>                 fldPrice,
M>                 fldQuantity,
M>                 fldGroupBuy,
M>                 fldGrouping
M>         )

M> VALUES
M>         (
M>                 #getLastInvoiceID.LastInvoice#,
M>                 #session.basket.PartID#,
M>                 '#session.basket.PartNumber#',
M>                 '#URL#',

This will cause the exact error you are seeing, since URL is not a
string. Changing the variable name URL to something else in your code
should fix the problem.

M>                 #PriceForQuery#,
M>                 #session.basket.Quantity#,
M>                 #session.basket.GroupBuy#,
M>                 #session.basket.Grouping#
                
M>         )
M>                 </CFQUERY>

M> And as show at the top of this email, it stops with an erro when 
M> trying to use the URL or thisStructList variables.

M> Does anybody else have any ideas?

Sure... :) CF should throw an error at compile time when a reserved word
is attempted to be set. That's sort of standard...don't know why CF
doesn't do it in the first place.

M> Cheers
M> Mark


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Get the mailserver that powers this list at 
http://www.coolfusion.com

Reply via email to