We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44580
    • 189 Posts
    I have the following migxloopcollection to populate a dropdown:
    [[migxLoopCollection?
    &classname=`modUserProfile`
    &tpl=`@CODE:[[+fullname]]==[[+internalKey]]`
    &outputSeparator=`||`
    &where=`{"primary_group":"2"}`
    &joins=`[{"alias":"User","classname":"modUser","on":"User.id=modUserProfile.internalKey"}]`
    ]]
    

    I want to return all the users that belong to a particular group (2). I think I've got the join wrong but I can't figure it. Help please.

    This question has been answered by Bruno17. See the first response.

    • discuss.answer
      • 4172
      • 5,888 Posts
      You forgot the User - alias before primary_group in the where-clause.

      This should work:
      [[migxLoopCollection?
      &classname=`modUserProfile`
      &tpl=`@CODE:[[+fullname]]==[[+internalKey]]`
      &outputSeparator=`||`
      &where=`{"User.primary_group":"2"}`
      &joins=`[{"alias":"User"}]`
      &debug=`0`
      ]]


      you don't need to define 'classname' and 'on' in joins, when they are defined with the xpdo-schema
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 44580
        • 189 Posts
        Perfect. Thanks again Bruno. I'm slowly getting there...