Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2001
    Posts
    12

    Unanswered: 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.

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Will this go any deeper ?

  3. #3
    Join Date
    Oct 2001
    Posts
    12
    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.

  4. #4
    Join Date
    Feb 2002
    Posts
    2,232
    What I meant was will you have any levels deeper than cat - subcat - item ?

  5. #5
    Join Date
    Oct 2001
    Posts
    12
    Originally posted by rnealejr
    What I meant was will you have any levels deeper than cat - subcat - item ?
    Yes.

  6. #6
    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.

  7. #7
    Join Date
    Oct 2001
    Posts
    12
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •