Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested Results Page

Status
Not open for further replies.

TonyCronin

Programmer
Jul 16, 2001
47
GB
Hi,

I am trying to figure out how to display nested results on a page.. I want it to look something like this..

HR Human Resources
Commercial Business Development
Account Management
Operations Helpdesk
Internal IT
Development Team

I have a query where it returns all the info and I can display it ok like this..

HR Human Resources
Commercial Business Development
Commercial Account Management
Operations Helpdesk
Operations Internal IT
Operations Development Team

But cant get rid of duplicate departments..

Any help appreciated,
TonyC

 
You will have to hand code it...
Store the first columns value in a variable and in the repeat region check if the column has changed - if so then reset the variable and display the column value else display a blank.

i.e. (in Jscript)
Code:
<% PrevGroup = &quot;&quot;;%>
<% while ((Repeat1__numRows-- != 0) && (myRecordset.EOF)) { %>
        <% GroupName = myRecordset.Item(&quot;GROUP_NAME&quot;).Value;
			if (GroupName != PrevGroup) {
			PrevGroup = GroupName;
		  %>
        <tr> 
          <td> <%=GroupName%></td>
        </tr>
          <% } else { %>

        <tr> 
          <td>   </td>
        </tr>
        <% } %>

...
...
<% } %>
Blood, Sweat But No Tears!
 
Superb - Thanks for your help.

For any other amateurs like me who needed to do this in VBSCRIPT.. this may help.. I set variable at the top..

<%Dim PrevGroup =&quot;&quot; %>

and at categories I used..

<% If myRecordset.Fields.Item(&quot;Department&quot;).Value <> PrevGroup Then %>
<font><% myRecordset.Fields.Item(&quot;Department&quot;).Value)%></font>
<% End If %>


and just before moving to next record I added..

<% PrevGroup = myRecordset.Fields.Item(&quot;Department&quot;).Value %>

Thanks again,
Tony.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top