We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11139
    • 34 Posts
    I want to sort the resources found by Getresources according to a template variable, eventDate. My chunk says:
    [[!getResources?
    &parents=`7`
    &depth=`0`
    &sortby=`eventDate`
    &includeTVs=`1`
    &tpl=`eventChunk`
    ]]

    It gives no output at all, but when I change `eventDate` to `pagetitle` it works fine. I’ve tried superstitiously with +eventDates and *eventDates and tv.eventDates but none of them produce any output.

    What am I doing wrong, please?

      • 22303 MODX Staff
      • 10,725 Posts
      You must use the sortbyTV and sortdirTV properties to sort by a template variable.
        • 11139
        • 34 Posts
        Thanks OpenGeek, works fine.

        It would be great to have this mentioned on the getResources page, how do I try to make that happen?
          • 11139
          • 34 Posts
          In fact, I would like to know how you found out, OpenGeek. Where is sortbyTV mentioned? I just searched the dashboard which claims to be the official MODx documentation and the search gave no results.
            • 25663 MODX Staff
            • 12,272 Posts
            Jason (Opengeek) wrote it, so he’s fairly familiar with the code.
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 27708 MODX Staff
              • 2,502 Posts
              Looks like the getResources docs got a little out of sync with the progress. I have added the TV related properties to the documentation.
                Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
                • 11139
                • 34 Posts
                @rthrash: Yes, I guess writing the code helps you to know what it does.

                @smashingred: Many thanks on behalf of your future info-seekers. I’m impressed by the speed and responsiveness. I just read what you wrote and I think it will be clear to people like me.