Skip to main content
Gene_Godsey
Inspiring
December 1, 2011
Question

Complex Daata Types

  • December 1, 2011
  • 2 replies
  • 1179 views

Message

Complex object types cannot be converted to simple values.

Detail

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 tried to use a complex value as a simple one. For example, you tried to use a query variable in a cfif tag.

This is a message that I getting from a Mach II exception.

I am using orm to create an object from a Oracle database.

The object will return but I am not getting data from the database and the data is not populating the object.

If I use the EntityLoad(nameOfClass) method I get the error

Using the

writeDump(nameOfClass);

return(nameOfClass); will display the object. I noticed that the ID field in this object was empty.

Any suggestion here are welcome.

    This topic has been closed for replies.

    2 replies

    BKBK
    Community Expert
    Community Expert
    December 2, 2011

    Gene Godsey wrote:

    Message

    Complex object types cannot be converted to simple values.

    Detail

    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 tried to use a complex value as a simple one. For example, you tried to use a query variable in a cfif tag.

    This is a message that I getting from a Mach II exception.

    I am using orm to create an object from a Oracle database.

    The object will return but I am not getting data from the database and the data is not populating the object.

    If I use the EntityLoad(nameOfClass) method I get the error

    Using the

    writeDump(nameOfClass);

    return(nameOfClass); will display the object. I noticed that the ID field in this object was empty.

    Any suggestion here are welcome.

    entityLoad('nameOfClass')

    Inspiring
    December 1, 2011

    Any suggestion here are welcome.

    Post the code.

    --

    Adam

    Inspiring
    December 1, 2011

    As Adam pointed out, without seeing the syntax of your code, there is no way to troubleshoot exactly where your code is going wrong.  As I'm sure you're aware, the error is occuring because CF is trying to evaluate a variable as a value and encountering a complex data type (structure, array, etc) in its place.  This could either be due to a coding mistake on the developers part, or a naming conflict between your internal app's variables and the framework that you are operating in.  With frameworks + ORMs, this can be difficult to troubleshoot because the code you have entered is going through the ORM and framework adapters and converted into the actual execution code in a way that is often hidden from view.

    The first step in debugging your application is to Dump out the variables you are using and double check to make sure that all variables that are expected to be a simple data type (for example "nameOfClass" sounds like it should be a string) actually are and are not an array or structure.  You can also double check if you really want to using CF's isSimpleValue(), though that seems a little unncessary in this case.

    If you have ensured that all of the developer-set variables are correct, then it may be that the problem is deeper in the ORM or framework.

    hope that helps

    - Michael