Copied to clipboard

Flag this post as spam?

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


  • Silvan Egger 28 posts 200 karma points
    Apr 18, 2016 @ 07:53
    Silvan Egger
    0

    Multinode Tree Picker - is this node picked anywhere?

    Hi together

    Is there an easy way i can find out if a node is picked in any multinode tree picker?

    -

    My case:

    I have two Document Types: Group and Person. Group has a property "Members" where you can choose some Persons with a multinode tree picker.

    Now when i display a Person i want to list all Groups this Person is a Member from.

    Is there an easy way to do this or do i have to loop trough every Group and compare the IDs?

    Greets, Silvan

  • Silvan Egger 28 posts 200 karma points
    Apr 18, 2016 @ 09:24
    Silvan Egger
    100

    OK, now i did this solution:

        List<String> groupsOfPerson = new List<String>();
    
        var groups = Umbraco.TypedContentAtRoot().First().Descendants("Group");
    
        foreach(var group in groups)
        {
            foreach(var memberId in group.GetPropertyValue("Members").ToString().Split(','))
            {
                if(memberId == CurrentPage.Id.ToString())
                {
                    groupsOfPerson.Add(group.Name);
                }
            }
        }
    

    But I'm not very satisfied ...

    Has anyone a better solution for this?

    Greets, Silvan

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies