Error Message: Complex object types cannot be converted to simple values.

Discussion in 'Programming' started by simone2000, Jan 4, 2007.

  1. #1
    Recently, I upgraded coldfusion 5.0 to coldfusion mx 6.1. However, I am getting the following error message when I try to run the pages in the browser:

    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.
    The most likely cause of the error is that you are trying to use a complex value as a simple one. For example, you might be trying to use a query variable in a <CFIF> tag. This was possible in ColdFusion 2.0 but creates an error in later versions.

    The code is:

    <cfif isdefined("attributes.act")>
    <cfset url = "act_"&"#attributes.act#"&".cfm">
    <cfinclude template = "#url#">
    <cfelseif isdefined("attributes.dsp")>
    <cfset url = "dsp_"&"#attributes.dsp#"&".cfm">
    <cfinclude template = "#url#">
    <cfelse>
    <cfinclude template="dsp_main.cfm">
    </cfif>


    and the error is on line.

    I'm new to coldfusion and not sure what is wrong. Can anyone help?
    Thanks
     
    simone2000, Jan 4, 2007 IP
  2. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #2
    a lot of issues arrised with my scripts as well when converting from 5 to 6

    You should contact the person that created the script...
     
    ccoonen, Jan 4, 2007 IP
  3. datropics

    datropics Peon

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #3
    what line is the error on - I just got up - maybe I'm not seeing it. Also you could done:

    <cfset url = "act_" & attributes.act & ".cfm">

    and

    <cfset url = "dsp_" & attributes.dsp & ".cfm">

    But I doubt that's your problem. I believe what most of us want to see is the 'type' of data that is in attributes.dsp and attributes.url. Could you show where you populated these variables.

    And what line number is the error on?
     
    datropics, Jan 12, 2007 IP
  4. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #4
    Actually, are you doing any dynamic variable setting? Instead of "Eval"ing variables, i converted them to the old-school <cfparam's and it fixed all my issues.
     
    ccoonen, Jan 13, 2007 IP