webdork
asked on
Display first instance of column only in recordset
I'm trying to display my recordset with the category column displaying only when the category changes.
<html>
<body>
<table width="200" border="0" cellspacing="0" cellpadding="3">
<tr>
<td>ID <br /></td>
<td>CAT </td>
<td>Item</td>
</tr>
<tr>
<td>1</td>
<td>A </td>
<td>Item A1 </td>
</tr>
<tr>
<td>2</td>
<td> </td>
<td>Item A2</td>
</tr>
<tr>
<td>3</td>
<td> </td>
<td>Item A3 </td>
</tr>
<tr>
<td>4</td>
<td>B</td>
<td>Item B1 </td>
</tr>
<tr>
<td>5</td>
<td> </td>
<td>Item B2</td>
</tr>
<tr>
<td>6</td>
<td> </td>
<td>Item B3 </td>
</tr>
<tr>
<td>7</td>
<td>B</td>
<td>Item C1 </td>
</tr>
<tr>
<td>8</td>
<td> </td>
<td>Item C2</td>
</tr>
<tr>
<td>9</td>
<td> </td>
<td>Item C3 </td>
</tr>
</table>
</body>
</html>
ASKER
Can you look at that included code block in HTML? Its a list of catagorized FAQ. I just want the category to show on the first Q and then again each time the category changes.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Here is the looping code. Can you give me a hint on how to remember the previous line?
<%
While ((Repeat1__numRows <> 0) AND (NOT rsFAQ.EOF))
%>
<div class="largeheader"><%=(rs FAQ.Fields .Item("FAQ cat").Valu e)%></div>
<div class="largeheader"><%=(rs FAQ.Fields .Item("Que stion").Va lue)%></di v>
<div class="feature"><%=(rsFAQ. Fields.Ite m("Answer" ).Value)%> </div>
<br>
<%
Repeat1__index=Repeat1__in dex+1
Repeat1__numRows=Repeat1__ numRows-1
rsFAQ.MoveNext()
Wend
%>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsFAQ.EOF))
%>
<div class="largeheader"><%=(rs
<div class="largeheader"><%=(rs
<div class="feature"><%=(rsFAQ.
<br>
<%
Repeat1__index=Repeat1__in
Repeat1__numRows=Repeat1__
rsFAQ.MoveNext()
Wend
%>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK I've got it.
<%
While ((Repeat1__numRows <> 0) AND (NOT rsFAQ.EOF))
%>
<div class="largeheader"><% IF LastCat <> rsFAQ.Fields.Item("FAQType ").Value THEN response.write rsFAQ.Fields.Item("FAQType ").Value END IF %></div>
<div class="feature"><strong><% =(rsFAQ.Fi elds.Item( "Question" ).Value)%> </strong>< /div>
<div class="feature"><%=(rsFAQ. Fields.Ite m("Answer" ).Value)%> </div>
<br>
<%
Repeat1__index=Repeat1__in dex+1
Repeat1__numRows=Repeat1__ numRows-1
LastCat = rsFAQ.Fields.Item("FAQType ").Value
rsFAQ.MoveNext()
Wend
%>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsFAQ.EOF))
%>
<div class="largeheader"><% IF LastCat <> rsFAQ.Fields.Item("FAQType
<div class="feature"><strong><%
<div class="feature"><%=(rsFAQ.
<br>
<%
Repeat1__index=Repeat1__in
Repeat1__numRows=Repeat1__
LastCat = rsFAQ.Fields.Item("FAQType
rsFAQ.MoveNext()
Wend
%>
ASKER
Thank you both, can you look at my next question?
https://www.experts-exchange.com/questions/24210467/Display-message-every-10-record.html
https://www.experts-exchange.com/questions/24210467/Display-message-every-10-record.html
ASKER
Thank you both, can you look at my next question?
https://www.experts-exchange.com/questions/24210467/Display-message-every-10-record.html
https://www.experts-exchange.com/questions/24210467/Display-message-every-10-record.html
What do you mean by: When the category changes?
Carrzkiss