Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 org chart

Author  Topic 

fd_job
Starting Member

3 Posts

Posted - 2008-04-02 : 09:14:35
Hi,

trying to build Orgchart with MS Access
columns: Name (text), Boss (data source, Name), Phone (int)

the question - how to avoid the "loop"?

1. prohibit choice for the current employee to choose himself as a leader
2. prohibit choice for the current employee to choose any subordinate level employee as a leader

VBA is not an option, we are planning to move this table to MS SQL server, so it should be a choice with "SELECT from Name...." with exceptions or any other checks with warning/error message...?

thank you
Anthony

X002548
Not Just a Number

15586 Posts

Posted - 2008-04-02 : 09:39:34
what's a hinge?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

fd_job
Starting Member

3 Posts

Posted - 2008-04-02 : 09:49:45
[quote]Originally posted by X002548

what's a hinge?

Pardon, I meant the loop.... on-line translator service gave me the "hinge" version ))
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2008-04-02 : 10:04:14
If you're using 2005, then you can use a CTE

If not, then there are several hacks I can provide



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2008-04-02 : 10:07:02
A simple solution to both 1 and 2 would be to add a column called "Level" that has a number acording to what level in the hierarchy a person is. Then, when somebody chooses a leader always make sure that that persons leader always has a level that is less than the person.

--
Lumbago
"SELECT Rum, Coke, Lime, Ice FROM bar WHERE ClosingTime = 'Late' AND FemaleMaleRatio > 4"
Go to Top of Page

fd_job
Starting Member

3 Posts

Posted - 2008-04-03 : 01:49:39
quote:
Originally posted by Lumbago

A simple solution to both 1 and 2 would be to add a column called "Level" that has a number acording to what level in the hierarchy a person is. Then, when somebody chooses a leader always make sure that that persons leader always has a level that is less than the person.

--
Lumbago
"SELECT Rum, Coke, Lime, Ice FROM bar WHERE ClosingTime = 'Late' AND FemaleMaleRatio > 4"



hmm....interesting idea....

one question:

we have 3 departments: director, IT dep (IT_boss, IT_empl_1, IT_empl_2), management group (M_boss, M_empl_1, M_empl_2), finance department (F_boss, F_empl_1, F_empl_2)

after org changes finance department moved to management group -> manager for finance dep "M_empl_2"

in other words: director, IT dep (IT_boss, IT_empl_1, IT_empl_2), management group (M_boss, M_empl_1, M_empl_2 -> finance department (boss, empl_1, empl_2)

which level for "empl_2" should be before/after changes?

Go to Top of Page
   

- Advertisement -