0
votes

I am getting an error after upgrade from coldfusionOX to coldfusion 10.

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

It occurs at line " cfloop index="local.thisRight" list="#rights#" ". It seems like ColdFusion does not like the "rights" here.

Anyone can give me some help? Thanks so much.

<cfif local.profile.rights.profile.self is not "">
    <cfquery name="local.getAffiliations" datasource="#Request.readerDSN#">
        SELECT tblPersonsToAffiliations.affiliationID, tblPersonsToAffiliations.rights, tblAffiliations.affiliationType, tblPersonsToAffiliations.relationshipType
            FROM tblPersonsToAffiliations INNER JOIN tblAffiliations
                ON tblPersonsToAffiliations.affiliationID = tblAffiliations.affiliationID
            WHERE tblPersonsToAffiliations.personID IN (#local.profile.rights.profile.self#)
            AND (tblPersonsToAffiliations.archived IS NULL
            OR tblPersonsToAffiliations.archived = '')
    </cfquery>
    <cfif local.getAffiliations.recordCount is not 0>
        <cfloop query="local.getAffiliations">
            <cfif local.getAffiliations.relationshipType is "interested">
                <cfset local.thisRelationshipType = "provisionalMember">
                <cfif IsDefined("local.profile.rights.#affiliationType#.#local.thisRelationshipType#")>
                    <cfset local.profile.rights[affiliationType][local.thisRelationshipType] = ListAppend(local.profile.rights[affiliationType][local.thisRelationshipType], affiliationID)>
                <cfelse>
                    <cfset local.profile.rights[affiliationType][thisRelationshipType] = affiliationID>
                </cfif>
            <cfelse>
                <cfset local.thisRelationshipType = "fullMember">
                <cfif IsDefined("local.profile.rights.#affiliationType#.#local.thisRelationshipType#")>
                    <cfset local.profile.rights[affiliationType][local.thisRelationshipType] = ListAppend(local.profile.rights[affiliationType][local.thisRelationshipType], affiliationID)>
                <cfelse>
                    <cfset local.profile.rights[affiliationType][local.thisRelationshipType] = affiliationID>
                </cfif>

                <cfif isNull(rights)>
                <cfelse>
                    <cfloop index="local.thisRight" list="#rights#" >
                        <cfif IsDefined("local.profile.rights.#affiliationType#.#local.thisRight#")>
                            <cfset local.profile.rights[affiliationType][local.thisRight] = ListAppend(local.profile.rights[affiliationType][local.thisRight], affiliationID)>
                        <cfelse>
                            <cfset local.profile.rights[affiliationType][local.thisRight] = affiliationID>
                        </cfif>

                    </cfloop>
                </cfif> 
            </cfif>
        </cfloop>
    </cfif>
</cfif>
2
Dump the variables in question and see what they actually are. - Dan Bracuk
The code you say is causing the error isn't in your example. - Matt Busche
That code still doesn't show where/how the "rights" variable is getting created. If it is a query column, you probably have other variables of the same name on the page getting used. take Dan's advice and cfdump 'rights' to see what's in it. - Brad Wood
When troubleshooting a problem, try to arrive at a repro case & post that. Don't just copy & paste your code from your app. Almost all your code there is probably not contributing to your problem, so you should get rid of it before posting it here for us to wade through. Also, try to lift the issue out of the context of your app, so as to remove any not-immediately-apparent contributing factors. The code you post should reflect only what's necessary to demonstrate your problem, and should be possible for us to copy & paste & run it. Suggest reading this: bit.ly/1K0hrrW (link to my blog) - Adam Cameron
... conted. This should also be how you perform your own troubleshooting before asking a question. Take steps to work out what the problem is, and revise your repro case to home in on the issue. Often you'll solve your own issues whilst taking this approach. Also at the very least always include the troubleshooting steps you yourself have already attempted. - Adam Cameron

2 Answers

0
votes

A bit earlier in your code you do this:

<cfif local.getAffiliations.relationshipType is "interested">

I think you need the same query name prefix in front of "rights" that is used when evaluating "relationshipType".

Try this:

#local.getAffiliations.rights#

HTH!

-1
votes

I am betting it is failing on this line:

 <cfloop index="local.thisRight" list="rights" >

You are attempting to use the string "rights" as a list. My first reaction would be that you need to make that:

 <cfloop index="local.thisRight" list="#rights#" >