Home All Groups Group Topic Archive Search About
Author
30 May 2005 7:38 PM
Amanda Hallock
I'm trying to make a table with values I pulled from a recordset - for
example a table has rows a,b,c and cols 1,2,3.  Each row is formed by a
loop, but I don't necessarily have values for each cell- the row is
determined by one of the fields- (in the example "y" specifies the row)

how do I start the loop over in the middle of the loop?

specifcally:
dbrs.MoveFirst()
do while not dbrs.eof
dbrs. Move(0)
    x = dbrs("x")
    y = dbrs("y")

%>
<tr>
<% if x = "a1" then
      response.write("<td>" & value1 & "</td>")
   else
      response.write("<td></td>")
   end if
   dbrs.MoveNext
   y2 = dbrs("y")
   if y2 = y1 then
     'continue with code
   else
     response.write("<td colspan=2></td></tr>")
     ' ? goto beginning of loop
   end if
%>
<td>
<% if x = "a2" then
      response.write("<td>" & value2 & "</td>")
  else
      response.write("<td></td>")
   end if
   dbrs.MoveNext
   y2 = dbrs("y")
   if y2 = y1 then
     'continue with code
   else
     response.write("<td></td></tr>")
     ' ? goto beginning of loop
   end if
%>
<td>
<% if x = "a3" then
      response.write("<td>" & value3 & "</td>")
  else
      response.write("<td></td>")
   end if
%>
</tr>
<%
dbrs.MoveNext
loop
%>

Thanks, Amanda


*** Sent via Developersdex http://www.developersdex.com ***

Author
31 May 2005 3:40 PM
Saga
Place

dbrs.MoveFirst()

where you have

>     ' ? goto beginning of loop

The above will start the loop over. Now if what you want
is to just move on to the next loop item, then you need to
nest your IF statements in such a way so that no further
code within the loop will be excuted until the next time
around.

Good luck
Saga

Show quoteHide quote
"Amanda Hallock" <aman***@southwind.org> wrote in message
news:Oa0cx8UZFHA.1404@TK2MSFTNGP09.phx.gbl...
> I'm trying to make a table with values I pulled from a recordset - for
> example a table has rows a,b,c and cols 1,2,3.  Each row is formed by
> a
> loop, but I don't necessarily have values for each cell- the row is
> determined by one of the fields- (in the example "y" specifies the
> row)
>
> how do I start the loop over in the middle of the loop?
>
> specifcally:
> dbrs.MoveFirst()
> do while not dbrs.eof
> dbrs. Move(0)
>    x = dbrs("x")
>    y = dbrs("y")
>
> %>
> <tr>
> <% if x = "a1" then
>      response.write("<td>" & value1 & "</td>")
>   else
>      response.write("<td></td>")
>   end if
>   dbrs.MoveNext
>   y2 = dbrs("y")
>   if y2 = y1 then
>     'continue with code
>   else
>     response.write("<td colspan=2></td></tr>")
>     ' ? goto beginning of loop
>   end if
> %>
> <td>
> <% if x = "a2" then
>      response.write("<td>" & value2 & "</td>")
>  else
>      response.write("<td></td>")
>   end if
>   dbrs.MoveNext
>   y2 = dbrs("y")
>   if y2 = y1 then
>     'continue with code
>   else
>     response.write("<td></td></tr>")
>     ' ? goto beginning of loop
>   end if
> %>
> <td>
> <% if x = "a3" then
>      response.write("<td>" & value3 & "</td>")
>  else
>      response.write("<td></td>")
>   end if
> %>
> </tr>
> <%
> dbrs.MoveNext
> loop
> %>
>
> Thanks, Amanda
>
>
> *** Sent via Developersdex http://www.developersdex.com ***