Coldfusion 10 cfloop错误

时间:2015-05-30 00:57:44

标签: coldfusion coldfusion-10

从coldfusionOX升级到coldfusion 10后,我收到错误。

  

处理请求复杂对象类型时发生错误   转换为简单值。

     

表达式已请求变量或中间表达式   结果作为一个简单的价值。但是,结果无法转换为   简单的价值。简单的值是字符串,数字,布尔值和   日期/时间值。查询,数组和COM对象是其示例   复杂的价值观导致错误的最可能原因是您尝试过   使用复杂的值作为一个简单的值。例如,您尝试使用   cfif标记中的查询变量。

它出现在“cfloop index="local.thisRight" list="#rights#"”行。似乎ColdFusion不喜欢这里的“权利”。

任何人都可以给我一些帮助吗?非常感谢。

<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 个答案:

答案 0 :(得分:0)

在您的代码中稍早一点:

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

我认为你需要在&#34;权利&#34;前面使用相同的查询名称前缀。在评估&#34; relationshipType&#34;。

时使用

试试这个:

#local.getAffiliations.rights#

HTH!

答案 1 :(得分:-1)

我打赌它在这条线上失败了:

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

您正尝试将字符串“rights”用作列表。我的第一反应是你需要做到这一点:

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