Hierarch

ilanray

Member
Local time
Today, 16:03
Joined
Jan 3, 2023
Messages
129
Hi
I would like to create Hierarch in my employee table. I created a new field with name "teamLeader" which is the manager of the employee
I would like to have in a new table all Hierarchy sepetate by comma for example
A is the Boss, b is the manager, c is teamleader which has few employee . The new field for b should look like(A,B)
For the employee it should be (A,B,C) etc
Anyone have an idea

Thanks
 
I would recommend doing a self reference.
The example includes an employee tree
 
The way I did this is with a Team table and a Personnel table.

Every team had its own PK (as well as a name). Every employee had his/her own PK (as well as names). Each Team entry had a slot for "team leader" which pointed to one of the members of the Personnel list. Each Personnel entry had a slot for "team" which pointed to one of the Team entries.

That lasted until things got so hectic that we had to allow some overlap. The second iteration became a junction table of "Team ID, Person ID" and there was a Yes/No flag that was "Team Leader" - So each team leader entry was marked as such and other team members were just <Team ID, Person ID, No>.
 
suggest you also need a from date and perhaps a to date to cover situations where an employee moves to a new role or leaves the company
 
Self Referencing. Data storage and treeview display. Treeview demos drag and drop. So you can move a manager under a new boss and the whole branch moves because you simply changed the managers supervisor ID.

TreeEmp.jpg
 

Attachments

Last edited:
just pointing out how to handle some management organizations I have had to deal with over the years that didn't quite fit the self referencing model.
Fully concur. I could not model my job in a pure hierarchy. I would have three team leads across two companies. However the OP only a presented a single pure hierarchy for a new employee, ABC, not a matrix (ABC and AEG and FBC and...)
 

Users who are viewing this thread

Back
Top Bottom