Connecting Tech Pros Worldwide
 
 
sign in | join about | help | sitemap
[ http://bytes.com/adLoader.php?parent=webdev
GazMathias's Avatar

Seperating a Table by Category.


Question posted by: GazMathias (Member) on October 8th, 2008 02:18 PM
Hi all,

I am writing a page for our intranet that lists useful office documents / dashboards. At the moment I am simply just looping the recordset into a table.

I would like to add a bit of seperation to the table, using the document's category, of the format:

Category Name or Pic
|Table | Table | Table|

Category Name or Pic
|Table | Table | Table|

Etc.

Gaz
post reply
Quote | Subscribe
2 Answers Posted
jeffstl's Avatar
Expert - 405 Posts
#2: Re: Seperating a Table by Category.

It would help if I could see the loop you have set up now that writes out your table.

Offhand you will need something to be able to check these categories your talking about.

Are all the documents named a certain way? Are the documents separated by folders that also represent these categories?

If either of those are true you should be able to do what you want with some checks on those properties.

Expand|Select|Wrap|Line Numbers
Select Case fso.FolderName       Case "MyCategory"      'place these files into an array to print out this table       Case "MyCategory2"      'place these files into an array to print out this table End Select


This is a very quick general example (honestly im not even sure if the FSO syntax is right ;) but it should give you an idea.
GazMathias's Avatar
Member - 52 Posts
#3: Re: Seperating a Table by Category.

Hi,

Thanks for the reply.

I am not using the filesystem to find the documents, as they are stored in such a wide range of directories, and moving them to one place would be impractical.

Everything is read from a database that the users manage through the site itself.

I got there in the end:

First, I added an ORDER BY Category clause to the sql statment.

I then used a loop structured like the following:

Expand|Select|Wrap|Line Numbers
<% Dim cat   cat =""   Do While Not RS.EOF   If Not Cat = RS("Category") Then  %>   <Row to output if category header>   <%  cat = RS("Category")  End IF  %>   <rows containing document info>   <% RS.Movenext Loop %>


Hopefully, that will be of some use to someone else!

Gaz
Reply
Not the answer you were looking for? Post your question . . .
196,220 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,220 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top ASP Contributors

[ http://bytes.com/adLoader.php?parent=webdev


You are viewing a mobilized version of this site...
View original page here

How do you rate mobile version of this page?

Mobilized by Mowser Mowser