Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Complex object types cannot be converted to simple values.

Guest
Aug 30, 2006 Aug 30, 2006
I am new to MX7, I test two lines of code as below:

<cfset url="#cgi.script_name#">
<cfoutput>#url#</cfoutput>
Then the error message shows:
---------------------------
Complex object types cannot be converted to simple values.
The expression has requested a variable or an intermediate expression result as a simple value, however, the result cannot be converted to a simple value. Simple values are strings, numbers, boolean values, and date/time values. Queries, arrays, and COM objects are examples of complex values. .....

-----------------------

Please help.
1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 30, 2006 Aug 30, 2006
'URL' is a reserved variable in ColdFusion MX that contains any GET
passed variables, ie the query string.

You just need to use something else for your variable.

<cfset myURL = cgi.script_name>
<cfoutput>#myURL#</cfoutput>

Also note that there is no need to use the #'s in the cfset.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 30, 2006 Aug 30, 2006
Thanks. I got it.
However, it worded in CF5.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Aug 30, 2006 Aug 30, 2006
LATEST
Well, if you insist on naming your variable URL, then "scope" it properly in the output.

This works, but I don't recommend it:

<cfset url=cgi.script_name>
<cfoutput>#variables.url#</cfoutput>

Phil
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 30, 2006 Aug 30, 2006
Thanks. I got it.
However, it worded in CF5.

Yes, in CF versions previous to MX you could override the 'URL' variable
structure with your own data.

Since MX, you can't do that anymore.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources