Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • E.J. Brennan 73 posts 114 karma points
    Mar 14, 2011 @ 18:26
    E.J. Brennan
    1

    many to many relationship in umbraco

    OK, the title isn't exactly accurate, but this is what I would like to do - I know I can do it using custom database tables and .net, but wondering how it might be accomplished in a pure umbraco fashion.

    Let say I am doing an intranet app for a small company. Each department will get a page, and each employee will have his or her own page with some contact information. Each department page will have some information about the department, and then a list of the employees that work in the department - and then a user can click thru and get the details about an employee. All of that I can do easily with various document types and standard navigation.

    Now say I have a situation where an employee can work for more than one department, and on each department page I would like a list of each of the employees in that department to show, so some employees will appear in 1-N departments.

    This would be trivially easy to do with my own set of sql tables and custom controls (I'd add a 'linking' table that relates departments to people - but how might this be accomplished without restorting to asp.net.  I suppose I could re-use some of the logic that relates blog posts to tags, but is there a different/better way?

    Suggestions?

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Mar 14, 2011 @ 18:43
    Hendy Racher
    1

    Hi,

    How have you currently structured your content tree ? I'm guessing you perhaps have employee nodes beneath dept nodes ?

    If this is the case how about splitting them into:

    Departments

    - Dept 1

    - Dept 2

    Employees

    - Emp 1

    - Emp 2

    and then using a multipicker on the either the Dept nodes to choose the associated people, or on the Emp nodes to choose the departments ? (you can also wire up the relation types API to enable speedy reverse lookups - which I'm guessing would be very similar to how you where thinking for the SQL lookup table)

    HTH,

    Hendy

Please Sign in or register to post replies

Write your reply to:

Draft