Click here to Skip to main content
16,020,974 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
If i have a list of categories like:
1. Billboards and advertisement section
  1(a)City Clock
    1(a)(i)Application fee  (has columns for approved price and proposed price)
    1(a)(ii)Advertisement Per year (has columns for approved price and proposed price)

  1(b)Billboards
    1(b)(i)Application fee for construction (has columns for approved price and proposed price)
    1(b)(ii)Charge per year without advertisement (has columns for approved price and proposed price)

  1(c)Something here.....
    1(c)(i) something here...(has columns for approved price and proposed price)
    1(c)(ii)something here...(has columns for approved price and proposed price)
    1(c)(iii) something here... (has columns for approved price and proposed price)
     e.t.c

THEN SOME CATEGORIES LOOK LIKE:category 2
2. Category name
  2(a)something here..(has columns for approved price and proposed price)
  2(b)something here..
    2(b)(i)something here..(has columns for approved price and proposed price)
    2(b)(ii)something here..(has columns for approved price and proposed price)

NOW: i have categories without sub categories and others with sub-sub categories , a main category doesn't does have a column for prices ( or lets just say other columns) , a sub category WITHOUT its sub category will have columns for prices, if a sub category has its sub category, then its subcategory should have columns for prices (this is where my problem is - how do i handle such a situation in vb.net?? )
Posted
Updated 18-Jan-12 17:28pm
v2
Comments
Sergey Alexandrovich Kryukov 19-Jan-12 0:58am    
What's so special about it? It happens nearly everywhere. Is there any particular problem with that?
--SA
joseph k 19-Jan-12 3:18am    
Its just complicated when it comes to a user interface that used to manage such kind of data. (add, edit , delete)

lol!!! Education:
Thanks for the heads up! i needed that. Now i remember last semester i learnt Data Structures, where i encountered linked lists, arrays, different types of trees. Well, i implemented a tree in VBA once but it was not to third siblings.

Now: I think the problem is putting in database, and How to design a form that helps a novice user to manage this kind of data.

FROM my memory, i remember that the structures you have told me usually helps in memory usage and efficiency of code. Well, am sure to implement the best when it comes to that.

Well, am trying to figure out how allow the user to edit , add and delete from this structure. (Tree)

Here is the database structure i have in mind (MySQl):
SQL
CREATE TABLE IF NOT EXISTS `price_category` (
  `act_code` int(20) NOT NULL,
  `name` text NOT NULL,
  PRIMARY KEY  (`act_code`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Table structure for table `price_sub_category`
--

CREATE TABLE IF NOT EXISTS `price_sub_category` (
  `id` int(11) NOT NULL auto_increment,
  `act_code` int(20) NOT NULL,
  `name` text NOT NULL,
  `aprovedp1` int(20) default NULL,
  `aprovedp1y` char(20) default NULL,
  `aprovedp2` int(20) default NULL,
  `aprovedp2y` char(20) default NULL,
  `proposedp` int(20) default NULL,
  `proposedpy` char(20) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `price_sub_sub_category`
--

CREATE TABLE IF NOT EXISTS `price_sub_sub_category` (
  `id` int(11) NOT NULL auto_increment,
  `act_code` int(20) NOT NULL,
  `sub_code` int(20) NOT NULL,
  `name` text NOT NULL,
  `aprovedp1` int(20) default NULL,
  `aprovedp1y` char(20) default NULL,
  `aprovedp2` int(20) default NULL,
  `aprovedp2y` char(20) default NULL,
  `proposedp` int(20) default NULL,
  `proposedpy` char(20) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
 
Share this answer
 
There is no such problem. This is nothing more but a data structure representing a tree, one of the most common in programming.

That said, you don't have such problem and you should not solve this particular problem. First, you urgently need to solve another problem — the problem of your own computing education. One small part if this problem is learning of most common data structures, such as trees, different kinds of linked lists, other lists, hash tables, dictionaries, etc. OK, start with the tree:

http://en.wikipedia.org/wiki/Tree_%28data_structure%29[^].

Just a warning: don't try to simplify or "de-generalize" the data structure you described in your question — this is a tree and nothing else.

And one extreme warning: don't try to avoid education by using excuses such as "I don't have time right now". Following this way, you will eventually get stuck for the rest of your life. Yes, jokes aside.

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900