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">#NumberForma t(studentC orrectPerc entage[s], '99')#%</td>
<cfloop index="j" list="#gettestlet.included Items#" 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(itemsAnswere dForEachSt udent[s])# ">
<cfif itemsAnsweredForEachStuden t[s][k] eq j>
<td align="center" class="item_mark"><cfif studentPerformanceOnEachIt em[s][k] eq 1>
C
<cfelse>
X
</cfif>
<!---cfoutput>#studentPerf ormanceOnE achItem[s] [k]#</cfou tput--->
</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>
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;
<td align="right">#NumberForma
<cfloop index="j" list="#gettestlet.included
<!--- 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(itemsAnswere
<cfif itemsAnsweredForEachStuden
<td align="center" class="item_mark"><cfif studentPerformanceOnEachIt
C
<cfelse>
X
</cfif>
<!---cfoutput>#studentPerf
</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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
As always, thanks for the help. Very much appreciated
-Nick