Link to home
Start Free TrialLog in
Avatar of webdork
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>&nbsp;</td>
    <td>Item A2</td>
  </tr>
  <tr>
    <td>3</td>
    <td>&nbsp;</td>
    <td>Item A3 </td>
  </tr>
  <tr>
    <td>4</td>
    <td>B</td>
    <td>Item B1 </td>
  </tr>
  <tr>
    <td>5</td>
    <td>&nbsp;</td>
    <td>Item B2</td>
  </tr>
  <tr>
    <td>6</td>
    <td>&nbsp;</td>
    <td>Item B3 </td>
  </tr>
  <tr>
    <td>7</td>
    <td>B</td>
    <td>Item C1 </td>
  </tr>
  <tr>
    <td>8</td>
    <td>&nbsp;</td>
    <td>Item C2</td>
  </tr>
  <tr>
    <td>9</td>
    <td>&nbsp;</td>
    <td>Item C3 </td>
  </tr>
</table>
</body>
</html>

Open in new window

Avatar of Wayne Barron
Wayne Barron
Flag of United States of America image

chan you explain that  a little bit more please?
What do you mean by: When the category changes?

Carrzkiss
Avatar of webdork
webdork

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
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg 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 webdork

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"><%=(rsFAQ.Fields.Item("FAQcat").Value)%></div>
            <div class="largeheader"><%=(rsFAQ.Fields.Item("Question").Value)%></div>
            <div class="feature"><%=(rsFAQ.Fields.Item("Answer").Value)%></div>
            <br>
            <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rsFAQ.MoveNext()
Wend
%>
SOLUTION
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 webdork

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.Fields.Item("Question").Value)%></strong></div>
            <div class="feature"><%=(rsFAQ.Fields.Item("Answer").Value)%></div>
            <br>
            <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  LastCat = rsFAQ.Fields.Item("FAQType").Value
  rsFAQ.MoveNext()
Wend
%>