VB6 TreeView Hi all
I am writing a payroll application that uses entities and attributes to describe Companies, Jobs and Employees. The rules are as follows:
1) Companies are at the highest level
2) Jobs link to companies
3) Employees link to jobs
The issue is that 1 or many jobs can belong to 1 or many companies and 1 or many employees can belong to 1 or many jobs. This is enforced in the EntityLinks table (See attached diag).
I need to create a treeview that shows the heirarchy as follows:
Company 1
-----> Job 1
----------> Employee 1
-----> Job 2
----------> Employee 1
----------> Employee 2
Company 2
-----> Job 2
----------> Employee 1
----------> Employee 3
----------> Employee 4
-----> Job 3
----------> Employee 2
----------> Employee 6
----------> Employee 9
I have been pulling my hair out over this for the last 4 days and have written lots of code from examples on the internet.
Problem: Because Parent and Child Entities can appear multiple times in the entity links table, i am struggling with a unique Key at each level of the treeview. Bearing in mind that i need the entityID(EID) and the EntityAttributeDescription(EntAttText) for each entity.
tvEntAttRel.Nodes.Add(, , "a" & Trim$(rs.Fields("EID")), Trim(rs.Fields("EntAttText")), 1, 1)
The only unique value for the links is the EntityLinksID(ELINKID), that would make the key unique, but there is no place in the above line of code to put it
ideally, it would be:
tvEntAttRel.Nodes.Add(, , "a" & Trim$(rs.Fields("ELINKID")), Trim$(rs.Fields("EID")), Trim(rs.Fields("EntAttText")), 1, 1)
WHERE:
ELINKID is the uniqueID for entity link (job to comp, or emp to job etc)
EID is the uniqueID for the entities in the link
EntAttText is the description of the entity ie Job1,Company 1
Please let me know if this post is not clearly understandable
Please Help
Thanks
Chris |