Software Design
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreSoftware Design

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #16  
Old January 31st, 2002, 08:01 PM
noslenj123 noslenj123 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: Phoenix, AZ
Posts: 484 noslenj123 User rank is Sergeant Major (2000 - 5000 Reputation Level)noslenj123 User rank is Sergeant Major (2000 - 5000 Reputation Level)noslenj123 User rank is Sergeant Major (2000 - 5000 Reputation Level)noslenj123 User rank is Sergeant Major (2000 - 5000 Reputation Level)noslenj123 User rank is Sergeant Major (2000 - 5000 Reputation Level)noslenj123 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 22 h 6 m 30 sec
Reputation Power: 30
andnaess,

It sounds like you have a solution. However if you do not I can offer some code I wrote in perl which displays the Org chart of a large company in just the way you describe in html. It has a lot of extra code that doesn't apply but it may work for you.

It uses the id,parent method as I have seen in this thread and basically uses two queries and a recursive routine.

The first one builds a string I call the $parentList. Based on the id of the person in the org chart the user clicks on it builds a space delimeted list of parents back to the root node.

That string is needed for the recursive routine which issues on query for everytime it is called (the number of levels deep into the tree). We query the database for nodes with a null parent and display the information. If the id of this node is in the $parentList string we call ourself recursively so the next time we get nodes with this id as a parent.

Man, I hope that makes sense. Anyway, I will post the code with extra stuff scraped out if this is of any interest to you. It is a very interesting topic.

Another problem we had to solve is similar. It involves a hierarchy again like that of a product list. How do you know if a product exists as a child of any particular nodes above it. Given a hierarchy like "Products/TV's,Sony,Remote" how can you, with one query, determine if "Remote" belongs to "Sony"? Or belongs to "Products", or of course "Tv's"? Our solution is not pretty but works and could be a whole other thread topic.

Code on, brothers!!

Joel

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > Best method for a parent/child type relationship


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT