Link to home
Start Free TrialLog in
Avatar of nmarano
nmarano

asked on

cfloop. cfbreak

Experts,

I have this code below that doesn't seem to be working correctly.  This data is getting spit out into a table, and whenever I have students that did not answer any questions, I am expecting a '0', but instead getting a blank row.  If a student looks at a question, but doesn't answer we send this string to the database "noag^tasktime~2.00"  What I think is happening is when the <cfset matchFound = 1> it does break the loop because it is simply looking to see if something is in the database for this student.  I didn't write this code, and I'm not sure how to get around this.  If anyone has any suggestions, it would be greatly appreciated.  

The code.....
<cfoutput query="getstudent">
    <cfset s = s +1>
    <tr>
      <th align="left" scope="row" style="white-space:nowrap; ">#getstudent.lastName#, #getstudent.firstName#</th>
      <td align="right">#NumberFormat(studentCorrectPercentage[s], '99')#%</td>
      <cfloop index="j" list="#gettestlet.includedItems#" delimiters=",">
        <!--- this loop compare the items answered with the whole list items, if there is no answer, fill 0, otherwise indicate correct or not --->
        <cfloop index="k" from="1" to="#ArrayLen(itemsAnsweredForEachStudent[s])#">
          <cfif itemsAnsweredForEachStudent[s][k] eq j>
            <td align="center" class="item_mark"><cfif studentPerformanceOnEachItem[s][k] eq 1>
                C
                <cfelse>
                X
              </cfif>
              <!---cfoutput>#studentPerformanceOnEachItem[s][k]#</cfoutput--->
            </td>
            <cfset matchFound = 1>
            <cfbreak>
            <cfelse>
            <cfset matchFound = 0>
          </cfif>
        </cfloop>
        <cfif matchFound eq 0>
          <td align="center" class="item_mark"> O </td>
        </cfif>
      </cfloop>
    </tr>
  </cfoutput>
ASKER CERTIFIED SOLUTION
Avatar of gdemaria
gdemaria
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nmarano
nmarano

ASKER

Maria-
As always, thanks for the help.  Very much appreciated
-Nick