Results 1 to 14 of 14
  1. #1
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Treeview Question (A2K SR1)

    Treeview can depict data in a one to many relationship. Is it possible for treeview to show a many to one relationship. I dont think this is possible but figured I would ask as some users have requested this feature. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>
    Regards,

    Gary
    (It's been a while!)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Treeview Question (A2K SR1)

    Stand the monitor on its head?

    But seriously, can you give an example of what those users wanted?

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Treeview Question (A2K SR1)

    Um, what's the difference between a one-to-many and a many-to-one relationship besides the direction? Like Hans, I'm unable to picture a many-to-one treeview. The essence of Treeview is drilldown, and I can't conceive of a way to drill down from "many". <img src=/S/confused.gif border=0 alt=confused width=15 height=20>
    Charlotte

  4. #4
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Treeview Question (A2K SR1)

    Hans,

    I particularly like the stand the monitor on its head response, however, our IT department may not appreciate it.

    Here is what I am up against, a simple example follows:

    1. Material A is made up of Items 1, 2, and 3.
    - In Treeview, double clicking on Material A (parent) shows the links to Items 1, 2, and 3. (One to Many view)

    2. Item 1 is then used to make Stuff 1.
    - double clicking on Item 1 shows the link to Stuff one (One to One View)

    3. Items 2 and 3 are used to make Stuff 2.
    - when double clicking on Items 2 or 3, all links to Stuff 2 would be shown. (One to Many)

    This gets worse as each child at any level can be used to create one or many new children.

    Basically, what I am driving at is that after double clicking a parent, if the child has more then one parent, then show all branches from the child to all of its parents.

    Am I making any sense? <img src=/S/dizzy.gif border=0 alt=dizzy width=15 height=15>
    Regards,

    Gary
    (It's been a while!)

  5. #5
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Treeview Question (A2K SR1)

    Oh, come on Charlotte, where is your sense of adventure? <img src=/S/sailing.gif border=0 alt=sailing width=25 height=25> I haven't asked any insanely, illogical, and dumb questions recently. What I need is the ability to go backwards while going forwards. See my response to Hans for an example as he replied first.
    Regards,

    Gary
    (It's been a while!)

  6. #6
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Treeview Question (A2K SR1)

    <hr>What I need is the ability to go backwards while going forwards.<hr>

    Sounds like you should watch Star Trek IV - The Voyage Home (Warp towards the sun and slingshot back in time)

    Sorry if I've broken any unwritten rules banning Star Trek references! <img src=/S/blush.gif border=0 alt=blush width=15 height=15>
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Treeview Question (A2K SR1)

    The Treeview control is not suitable for something like the attached picture. There are probably third-party ActiveX controls that can handle such diagrams. Perhaps others can help there.

    Have you thought about how to implement a data structure for such relationships? Seems complicated to me; it's easy to get bogged down in non-updateable queries.
    Attached Images Attached Images
    • File Type: gif x.gif (1.3 KB, 0 views)

  8. #8
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Treeview Question (A2K SR1)

    ... Beam Me Up, Scotty...
    Regards,

    Gary
    (It's been a while!)

  9. #9
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Treeview Question (A2K SR1)

    You said <<Have you thought about how to implement a data structure for such relationships? Seems complicated to me; it's easy to get bogged down in non-updateable queries.>>

    I have been thinking about this and have not come up with a good solution that doesn't make one pull ones hair out.

    What I may do is this. Use two main tables.

    Table 1 - Stores Parent level data (i.e., Material) and is linked to Table 2 that stores children.
    Now when a child becomes a parent (sounds natural...) programming will copy data from Table 2 and put it in Table 1 so the data can have children.

    Table 1 primary key is on IDParent (Autonumber)
    Table 2 primary key os on IDChild (Autonumber) with a separate ID, IDParent, that ties back to the parent or Table 1 id.

    This scenario is a pain as there is no end to the number of children, aunts, and uncles.... Thus my prior question as to how many levels deep treeview can go.

    Queries or tables would then be used to re-build the structure from parent to child to grandchild, etc. (Will probably do this by having a separate ID for level number but that is another headache.)

    Thanks for the help.
    Regards,

    Gary
    (It's been a while!)

  10. #10
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Treeview Question (A2K SR1)

    Let me suggest another approach. Use a single table with all entities being stored in that and indicated as what type of entry it is. Create a second table with two pointers showing a relationship between the two entities, and what kind of relationship it is. We've used that successfully in a couple of scenarios. FYI, another issue with the kind of treeview you are contemplating is that you have to build all the relationships before the Microsoft control is loaded, which can get pretty slow if you have several thousand or more entities. You may want to consider one of the third party controls.
    Wendell

  11. #11
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Treeview Question (A2K SR1)

    Wendell,

    Thanks for the advice but I may not be following you entirely. Are you setting the pointers in code and then leap frog them to build the heirachry. What happens if a parent has multiple children... unless you have two records for each data point, parent and child. You could then loop through the table to build the relationships... Interesting. Is this what you are referring to? BTW - you have given me some other ideas to try out tomorrow.

    Thanks.
    Regards,

    Gary
    (It's been a while!)

  12. #12
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Treeview Question (A2K SR1)

    We actually used a form in each case to establish the relationships between entities. Then we built the multi-level treeview nodes, typically for a given relationship type. It's not terribly straightforward, but neither is the problem you are trying to solve. And it may not be able to solve the kind of logic nodes you indicated in your example drawing - haven't tried it with that kind of approach.
    Wendell

  13. #13
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Treeview Question (A2K SR1)

    Wendell,

    If you don't mind me asking, how many levels deep did your treeview go?

    ... I am still struggling with solving this one.
    Regards,

    Gary
    (It's been a while!)

  14. #14
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Treeview Question (A2K SR1)

    In this case, I believe it was only two - but it seems to me it could have gone more. In at least some treeviews we've done, they were three deep, and I believe we did one that was four deep.
    Wendell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •