title: Coldfusion 10 cfloop errors
body: <p>I am getting an error after upgrade from coldfusionOX to coldfusion 10.</p>
  
  <blockquote>
    <p>Error Occurred While Processing Request Complex object types cannot be
    converted to simple values.</p>
    
    <p>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.</p>
  </blockquote>
  
  <p>It occurs at line  " <code>cfloop index="local.thisRight" list="#rights#"</code> ". It seems like ColdFusion does not like the "rights" here. </p>
  
  <p>Anyone can give me some help? Thanks so much. </p>
  
  <pre><code>&lt;cfif local.profile.rights.profile.self is not ""&gt;
      &lt;cfquery name="local.getAffiliations" datasource="#Request.readerDSN#"&gt;
          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 = '')
      &lt;/cfquery&gt;
      &lt;cfif local.getAffiliations.recordCount is not 0&gt;
          &lt;cfloop query="local.getAffiliations"&gt;
              &lt;cfif local.getAffiliations.relationshipType is "interested"&gt;
                  &lt;cfset local.thisRelationshipType = "provisionalMember"&gt;
                  &lt;cfif IsDefined("local.profile.rights.#affiliationType#.#local.thisRelationshipType#")&gt;
                      &lt;cfset local.profile.rights[affiliationType][local.thisRelationshipType] = ListAppend(local.profile.rights[affiliationType][local.thisRelationshipType], affiliationID)&gt;
                  &lt;cfelse&gt;
                      &lt;cfset local.profile.rights[affiliationType][thisRelationshipType] = affiliationID&gt;
                  &lt;/cfif&gt;
              &lt;cfelse&gt;
                  &lt;cfset local.thisRelationshipType = "fullMember"&gt;
                  &lt;cfif IsDefined("local.profile.rights.#affiliationType#.#local.thisRelationshipType#")&gt;
                      &lt;cfset local.profile.rights[affiliationType][local.thisRelationshipType] = ListAppend(local.profile.rights[affiliationType][local.thisRelationshipType], affiliationID)&gt;
                  &lt;cfelse&gt;
                      &lt;cfset local.profile.rights[affiliationType][local.thisRelationshipType] = affiliationID&gt;
                  &lt;/cfif&gt;
  
                  &lt;cfif isNull(rights)&gt;
                  &lt;cfelse&gt;
                      &lt;cfloop index="local.thisRight" list="#rights#" &gt;
                          &lt;cfif IsDefined("local.profile.rights.#affiliationType#.#local.thisRight#")&gt;
                              &lt;cfset local.profile.rights[affiliationType][local.thisRight] = ListAppend(local.profile.rights[affiliationType][local.thisRight], affiliationID)&gt;
                          &lt;cfelse&gt;
                              &lt;cfset local.profile.rights[affiliationType][local.thisRight] = affiliationID&gt;
                          &lt;/cfif&gt;
  
                      &lt;/cfloop&gt;
                  &lt;/cfif&gt; 
              &lt;/cfif&gt;
          &lt;/cfloop&gt;
      &lt;/cfif&gt;
  &lt;/cfif&gt;
  </code></pre>