Click to See Complete Forum and Search --> : asp loop not working


gamble2003
04-17-2006, 05:33 PM
Hello - have a loop somewhere here that is not complete - can someone look at it for me?

I end the Expected statement:

/EmployeeRecogSurvey/SummaryResults.asp, line 353

wend
^

and I can't see what's tripping it - thanks!


<%
Dim cn, strSQL, rsSS
Dim intT1R1(4), intT1R2(4), intT1R3(4), intT1R4(4), intT1R5(4)
Dim intT2R1(4), intT2R2(4)
Dim intT3R1(4), intT3R2(4), intT3R3(4), intT3R4(4)
Dim intT4R1(2), intT4R2(2), intT4R3(2), intT4R4(2)
Dim intT5R1(4), intT5R2(4), intT5R3(4), intT5R4(4), intT5R5(4), intT5R6(4), intT5R7(4), intT5R8(4), intT5R9(4), intT5R10(4), intT5R11(4), intT5R12(4), intT5R13(4)
Dim intT6R1(4), intT6R2(4), intT6R3(4), intT6R4(4), intT6R5(4), intT6R6(4), intT6R7(4), intT6R8(4), intT6R9(4), intT6R10(4), intT6R12(4), intT6R13(4), intT6R14(4)
Dim intT7R1(4), intT7R2(4), intT7R3(2)
Dim intLoop, intIndex


****then********


rsSS.MoveFirst
for intLoop = 0 to 4
intT1R1(intLoop) = 0
intT1R2(intLoop) = 0
intT1R3(intLoop) = 0
intT1R4(intLoop) = 0
intT1R5(intLoop) = 0

intT2R1(intLoop) = 0
intT2R2(intLoop) = 0

intT3R1(intLoop) = 0
intT3R2(intLoop) = 0
intT3R3(intLoop) = 0
intT3R4(intLoop) = 0
next

for intLoop = 0 to 2
intT4R1(intLoop) = 0
intT4R2(intLoop) = 0
intT4R3(intLoop) = 0
intT4R4(intLoop) = 0
next
for intLoop = 0 to 4
intT5R1(intLoop) = 0
intT5R2(intLoop) = 0
intT5R3(intLoop) = 0
intT5R4(intLoop) = 0
intT5R5(intLoop) = 0
intT5R6(intLoop) = 0
intT5R7(intLoop) = 0
intT5R8(intLoop) = 0
intT5R9(intLoop) = 0
intT5R10(intLoop) = 0
intT5R11(intLoop) = 0
intT5R12(intLoop) = 0
next
for intLoop = 0 to 1
intT6R1(intLoop) = 0
intT6R2(intLoop) = 0
intT6R3(intLoop) = 0
intT6R4(intLoop) = 0
intT6R5(intLoop) = 0
intT6R6(intLoop) = 0
intT6R7(intLoop) = 0
intT6R8(intLoop) = 0
intT6R9(intLoop) = 0
intT6R10(intLoop) = 0
intT6R11(intLoop) = 0
intT5R12(intLoop) = 0
next
for intLoop = 0 to 3
intT7R1(intLoop) = 0
next
for intLoop = 0 to 1
intT7R2(intLoop) = 0
next
for intLoop = 0 to 3
intT7R3(intLoop) = 0
next

****then***********

while not rsSS.eof
if isNumeric(rsSS("SS_1Recogition")) then
if rsSS("SS_1Recogition") < 5 then
intT1R1(rsSS("SS_1Recogition")) = intT1R1(rsSS("SS_1Recogition")) + 1
end if
end if
if isNumeric(rsSS("SS_1Paycheck")) then
if rsSS("SS_1Paycheck") < 5 then
intT1R2(rsSS("SS_1Paycheck")) = intT1R2(rsSS("SS_1Paycheck")) + 1
end if
end if
if isNumeric(rsSS("SS_1Benefits")) then
if rsSS("SS_1Benefits") < 5 then
intT1R3(rsSS("SS_1Benefits")) = intT1R3(rsSS("SS_1Benefits")) + 1
end if
end if
if isNumeric(rsSS("SS_1Satisfied")) then
if rsSS("SS_1Satisfied") < 5 then
intT1R4(rsSS("SS_1Satisfied")) = intT1R4(rsSS("SS_1Satisfied")) + 1
end if
end if
if isNumeric(rsSS("SS_1Nature")) then
if rsSS("SS_1Nature")

'**** then Section 7 *****

if isNumeric(rsSS("SS_7Current")) then
if rsSS("SS_7Current") < 5 then
intT7R1(rsSS("SS_7Current")) = intT7R1(rsSS("SS_7Current")) + 1
end if
end if
if isNumeric(rsSS("SS_7Iam")) then
if rsSS("SS_7Iam") < 5 then
intT7R2(rsSS("SS_7Iam")) = intT7R2(rsSS("SS_7Iam")) + 1
end if
end if
if isNumeric(rsSS("SS_7Ihave")) then
if rsSS("SS_7Ihave") < 5 then
intT7R3(rsSS("SS_7Ihave")) = intT7R3(rsSS("SS_7Ihave")) + 1
end if
end if


wend <<<<<<<<<<<here's where it doesn't work>>>>>>>>>>>>>

rsSS.MoveNext

rsSS.close
set rsSS = nothing
%>
<table BORDER="0">
<tr>
<td WIDTH="740" ALIGN="center">


**********then the output Section 7 **************

<table BORDER="1" id="table24" cellspacing="1">
<tr>
<td width="180">&nbsp;</td>
<td ALIGN="bottom"><font face="Arial">0-1 year</font></td>
<td ALIGN="bottom"><font face="Arial">6 to 10 years</font></td>
<td ALIGN="bottom"><font face="Arial">11 to 20 years</font></td>
<td ALIGN="bottom"><font face="Arial">Over 20 years</font></td>
</tr>
<tr>
<td width="180"><font face="Arial">I have worked for the university for:</font></td>
<td ALIGN="center">&nbsp;<%Response.Write (intT7R3(4))%></td>
<td ALIGN="center">&nbsp;<%Response.Write (intT7R3(3))%></td>
<td ALIGN="center">&nbsp;<%Response.Write (intT7R3(2))%></td>
<td ALIGN="center">&nbsp;<%Response.Write (intT7R3(1))%></td>

</tr>
</table>
<h3><font face="Arial" size="3">Comments</font></h3>
<table border="1" width="100%" id="table25">
<tr>
<td>&nbsp;</td>
</tr>
</table>
<p align="center">&nbsp;</div>
</td>
</table>

Ubik
04-17-2006, 05:36 PM
You are missing two End if here:


if isNumeric(rsSS("SS_1Nature")) then
if rsSS("SS_1Nature")

'MISSING END IF HERE

'**** then Section 7 *****

if isNumeric(rsSS("SS_7Current")) then
if rsSS("SS_7Current") < 5 then
intT7R1(rsSS("SS_7Current")) = intT7R1(rsSS("SS_7Current")) + 1
end if
end if

gamble2003
04-17-2006, 05:40 PM
It is there...I just chopped the code to be able to post it here. (there's a word limit). Here's that section:
while not rsSS.eof
if isNumeric(rsSS("SS_1Recogition")) then
if rsSS("SS_1Recogition") < 5 then
intT1R1(rsSS("SS_1Recogition")) = intT1R1(rsSS("SS_1Recogition")) + 1
end if
end if
if isNumeric(rsSS("SS_1Paycheck")) then
if rsSS("SS_1Paycheck") < 5 then
intT1R2(rsSS("SS_1Paycheck")) = intT1R2(rsSS("SS_1Paycheck")) + 1
end if
end if
if isNumeric(rsSS("SS_1Benefits")) then
if rsSS("SS_1Benefits") < 5 then
intT1R3(rsSS("SS_1Benefits")) = intT1R3(rsSS("SS_1Benefits")) + 1
end if
end if
if isNumeric(rsSS("SS_1Satisfied")) then
if rsSS("SS_1Satisfied") < 5 then
intT1R4(rsSS("SS_1Satisfied")) = intT1R4(rsSS("SS_1Satisfied")) + 1
end if
end if
if isNumeric(rsSS("SS_1Nature")) then
if rsSS("SS_1Nature") < 5 then
intT1R5(rsSS("SS_1Nature")) = intT1R5(rsSS("SS_1Nature")) + 1
end if
end if

Ubik
04-17-2006, 06:05 PM
I would suggest copying your code to an application that can do search and replace. Most IDEs will do this, wordpad will too.

Search for 'end if' and replace with '--END IF--', write down how many were replaced.

Search for 'if ' (if with space), and replace with '--IF --' --IF with space and --. Write down how many were replaced.

If the numbers match, then you are golden. If not, then you are mismatched. The lower number will represent what your error is.

Do something similar with your other loops:

while/wend

for next

etc etc.

Just don't save your code after replacing all that stuff, this is just to count the loops for you.

You can also use this method to test bad html code from projects you have inherited - it's really fast at pointing to bad XML as well.

Anyway, have fun. Sorry, I cannot look through your code, I have to go eat dinner, then change the air in my tires, my dog ate my homework, etc etc.

gamble2003
04-17-2006, 06:12 PM
Thanks!! I got it - there were actually two of them - one in the 5th section, one in the 6th!
a very big thanks!