If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > What is the best way to design/show category, subcategory and item?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-21-03, 13:11
chanthirar chanthirar is offline
Registered User
 
Join Date: Oct 2001
Posts: 12
What is the best way to design/show category, subcategory and item?

Category may or may not have subcategory
Subcategory may or may not have item

Each of them can be select.

I put everything in one table like this:

ID, Name, Node, Parent
-----------------------
1, Color, 0, 0
2, Shape, 0, 0
3, Red, 1, 1
4, Green, 1, 1
5, Circle, 1, 2
6, Triangle, 1, 2
7, Rectangular, 1, 2
8, Item1, 2, 3
9, Item2, 2, 3
10, Item3, 2, 3
11, Item4, 2, 4
12, Item5, 2, 5
13, Item6, 2, 6
14, Item7, 2, 7
15, Item8, 2, 7

I want to show it as hierarchy follow this:
Color
1. Red
1.1 Item1
1.2 Item2
1.3 Item3
2. Green
2.1 Item4

Shape
1.1 Circle
1.1.1 Item5
1.2 Triangle
1.2.1 Item6
1.3 Rectangular
1.3.1 Item7
1.3.2 Item8

The way I did it before is open 3 record set - one for category (color, shape), and then another sub category (red, green, circle, triangle, rectangular), and then another one for looping items.

It's work at some point but I'm concern that it's kind of slow -- either my computer slow or because of inappropriate coding.

I used to separate category, sub category, and item to each table but it won't flexible for some of them that doesn't have item.

I wonder if this is the way that you guys do it or design it differently. Please advice.
Reply With Quote
  #2 (permalink)  
Old 11-21-03, 17:11
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Will this go any deeper ?
Reply With Quote
  #3 (permalink)  
Old 11-21-03, 17:14
chanthirar chanthirar is offline
Registered User
 
Join Date: Oct 2001
Posts: 12
Quote:
Originally posted by rnealejr
Will this go any deeper ?
It might but not all of them. I mean some of category may have sub category & item, but some of category may have only item and some of category may have nothing at all.
Reply With Quote
  #4 (permalink)  
Old 11-21-03, 17:21
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
What I meant was will you have any levels deeper than cat - subcat - item ?
Reply With Quote
  #5 (permalink)  
Old 11-21-03, 17:23
chanthirar chanthirar is offline
Registered User
 
Join Date: Oct 2001
Posts: 12
Quote:
Originally posted by rnealejr
What I meant was will you have any levels deeper than cat - subcat - item ?
Yes.
Reply With Quote
  #6 (permalink)  
Old 11-21-03, 17:50
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Really - So the number of levels deep is a variable... So you could have Cat-SubCat-Subsubcat-Item-subitem-subsubitem ... ?

Just want to make sure because a variable depth makes this more difficult.
Reply With Quote
  #7 (permalink)  
Old 11-21-03, 17:51
chanthirar chanthirar is offline
Registered User
 
Join Date: Oct 2001
Posts: 12
Quote:
Originally posted by rnealejr
Really - So the number of levels deep is a variable... So you could have Cat-SubCat-Subsubcat-Item-subitem-subsubitem ... ?

Just want to make sure because a variable depth makes this more difficult.
Yes, it's depends on user.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On