Copied to clipboard

Flag this post as spam?

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


  • Benoit Cornette 29 posts 169 karma points
    Nov 05, 2017 @ 11:00
    Benoit Cornette
    0

    Add category for a person

    Hi,

    I've got a structure where you can add persons to a team. Every person belongs to a certain category/subteam. I've tried to add this by a dropdown list as a property of the person document type. My question is, how do you loop over a foreach for the subteams first (sorted by an order that the client can adjust) and after that a foreach for displaying every person.

    I can display all the persons so my problem is the adjustment with a subteam and sorting by the order that the client wants...

    Thanks for tips in advance!

    Kind regards,

    Benoit

  • Nigel Wilson 945 posts 2077 karma points
    Nov 05, 2017 @ 18:26
    Nigel Wilson
    0

    Hi Benoit

    Where is your code ? Controller action method or a partial razor view.

    If razor then isn't it a case of:

    a foreach loop on the subteam (ordered by users preference) a nested foreach loop on the team members ?

    If this is way off track then please confirm where you are coding, what code you've got and maybe even a screenshot of the node tree to assist in visualising the structure.

    Cheers, Nigel

  • Benoit Cornette 29 posts 169 karma points
    Nov 05, 2017 @ 21:18
    Benoit Cornette
    0

    Hi Nigel,

    Below some some screenshots:

    • one of my code at this moment (get all persons)
    • one of the tree view
    • one of the document type with the property "department" that I want to use. Every person belongs to a department so in stead of displaying all the persons at once, I want to display every department with the persons that belong to that department.

    enter image description here

    enter image description here

    enter image description here

    Thanks for the help!

    Kind regards,

    Benoit

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Nov 05, 2017 @ 23:59
    Alex Skrypnyk
    0

    Hi Benoit

    Try to group your persons by departments, you can get all departments put them to array, iterate through this array and inside this for each try to loop through persons who are from this department. It should work

    Thanks,

    Alex

  • Benoit Cornette 29 posts 169 karma points
    Nov 06, 2017 @ 19:57
    Benoit Cornette
    100

    Hi,

    After 3 hours of searching i finally found it. Get the prevalues from the dropdown list from the data type ID and with that I've builded the foreach loops you mentioned.

    Case closed, thanks!

    Benoit

Please Sign in or register to post replies

Write your reply to:

Draft