Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old October 8th, 2008, 02:18 PM
GazMathias's Avatar
Expert
 
Join Date: Oct 2008
Location: Bristol, United Kingdom
Age: 30
Posts: 58
Default Seperating a Table by Category.

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
Reply
  #2  
Old October 8th, 2008, 06:52 PM
jeffstl's Avatar
Expert
 
Join Date: Feb 2008
Posts: 405
Default

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
  1. Select Case fso.FolderName
  2.       Case "MyCategory"
  3.      'place these files into an array to print out this table
  4.       Case "MyCategory2"
  5.      'place these files into an array to print out this table
  6. End Select
  7.  
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.
Reply
  #3  
Old October 9th, 2008, 11:11 AM
GazMathias's Avatar
Expert
 
Join Date: Oct 2008
Location: Bristol, United Kingdom
Age: 30
Posts: 58
Default

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
  1. <%
  2. Dim cat
  3.  
  4. cat =""
  5.  
  6. Do While Not RS.EOF
  7.  
  8. If Not Cat = RS("Category") Then 
  9. %>
  10.  
  11. <Row to output if category header>
  12.  
  13. <% 
  14. cat = RS("Category") 
  15. End IF 
  16. %>
  17.  
  18. <rows containing document info>
  19.  
  20. <%
  21. RS.Movenext
  22. Loop
  23. %>
  24.  
Hopefully, that will be of some use to someone else!

Gaz
Reply
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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 network members.
Post your question now . . .
It's fast and it's free

Popular Articles