Copied to clipboard

Flag this post as spam?

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


  • Solomon Shaffer 12 posts 75 karma points
    Apr 23, 2015 @ 21:02
    Solomon Shaffer
    0

    Relating Document Types to each other

    I am coming from Sitefinity where it is fairly easy to relate custom document types (called modules in Sitefinity) to each other. For instance, I have a custom Doc Type called Learning Track which has an ID and name. I also have a Course custom Doc Type which is related to one or more Learning Tracks. Is there any way to relate the two easily in the backend? Thanks!

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Apr 23, 2015 @ 21:25
    Dennis Aaen
    2

    Hi Solomon and welcome to our :-)

    I think that you could set up and relation type, I must admit that I haven´t used myself, but I hope those links can help you further. The first link is from the Umbraco advent calendar 2012 http://24days.in/umbraco/2012/who-picked-this/ and there is also a API for the relation https://our.umbraco.org/documentation/reference/Management-v6/Services/RelationService

    https://our.umbraco.org/documentation/Reference/Management/Relations/relationtype and a older blogpost from the Umbraco blog. http://umbraco.com/follow-us/blog-archive/2012/12/7/getting-to-know-umbraco-relations

    You wil find the folder under developer section --> Relation Types

    Hope this can help you further.

    /Dennis

  • Solomon Shaffer 12 posts 75 karma points
    Apr 23, 2015 @ 22:57
    Solomon Shaffer
    0

    Thank you. Do you know of any resources for v7? Seems like a lot of this functionality got left behind in previous versions.

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Apr 23, 2015 @ 23:02
    Chriztian Steinmeier
    2

    Hi Solomon,

    Usually, a simple relationship like that can be done using a picker of some sort on the Course doctype — I think you should have a look at the nuPickers package, which contains a wide range of pickers for setups like that. If, say, you have a total of 5 Learning Tracks, then you could add a CheckBoxPicker to the Course doctype, so that you pick one ore more Learning Track nodes for that specific Course. The picker is "live", so if you add another Learning Track, it will appear on all Course nodes right away.

    Most of the nuPickers also lets you store a "real" Relationship (in API terms) between the nodes that are picked and the one picking them, which you can use for various purposes, though it's not necessary.

    /Chriztian

  • Solomon Shaffer 12 posts 75 karma points
    Apr 24, 2015 @ 00:09
    Solomon Shaffer
    0

    Thanks for your help with the nuPickers. I see them mentioned in one of the article that Dennis sent as well. They work wonderfully. I am using SQL to fetch my list. As I am still a little unfamiliar with the database schema, do you see any problems with the following statement? Is there a better way to do this without using SQL?

    SELECT        cmsDocument.text AS Label, cmsDocument.nodeId AS [Key]
    FROM            cmsDocument INNER JOIN
                             cmsContent ON cmsDocument.nodeId = cmsContent.nodeId INNER JOIN
                             cmsContentType ON cmsContent.contentType = cmsContentType.nodeId
    WHERE        (cmsContentType.alias = 'Course') AND (cmsDocument.published = 1)
    ORDER BY Label
    
  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Apr 24, 2015 @ 00:33
    Hendy Racher
    0

    Hi Solomon,

    Your SQL works fine :) although you could use the XML pickers instead and get all published Courses with the following XPath expression:

    //Course

    much simpler configuration, but the order of the Xml one will be the order of the courses in the content tree.

  • Solomon Shaffer 12 posts 75 karma points
    Apr 24, 2015 @ 00:39
    Solomon Shaffer
    0

    Much easier. Thanks.

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    Apr 24, 2015 @ 08:15
    Dave Woestenborghs
    0

    Hi Solomon,

    I have an example of creating relations with the use of nuPickers in this article :

    http://skrift.io/articles/archive/the-king-is-dead-long-live-the-king/

    Dave

Please Sign in or register to post replies

Write your reply to:

Draft