We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46630
    • 40 Posts
    Hi, I need some help understanding relations in ModX.

    I have some resources which are called Projects. Each project has a TV called "financing_organization". This TV has as Input ResourceList of other resources called Financing organizations.

    Can someone help me to figure out how to display on the page of a Financing organization all the projects which are linked to it by the TV "financing_organization"? Can this be accomplished with getresources?

    Thank you in advance.

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

      • 33996
      • 20 Posts
      I suppose you can do that with getresources using its tvfilters property

      [[getresources?... &tvFilters=`financing_organization==[[*Financing organizations]]`]]
      • discuss.answer
        • 3749
        • 24,544 Posts
        The only way resources are related in MODX is by parent/child relations in the resource tree. If you can make the resources children of the Financing Organization pages, it gets very easy, though I can see why that might not be possible if there's a many-to-many relationship between projects and financing organizations. In that case, the best solution would be a custom DB table where each record lists the resource ID of a project page and the resource ID of an associated financing organization. This would mean developing a custom infrastructure to manage the table and produce the output. It's probably not worth it unless the site has a very large number of projects and financing organizations.

        The TV thing will work, but it may be somewhat slow. If there is a resource field you're not using (introtext, description, longtitle, menutitle, link_attributes, etc.) you could put the list there and use the &where property of getResources to grab the pages you want, but be careful about the length of each field.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
        • Tagger could be an alternative solution that I think is better suited to do filtering like the one you're doing because it has a dedicated data model, whereas TVs are not optimised for filtering.
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
            • 46630
            • 40 Posts
            Thank you all for the help!

            Because I was searching the most simple way possible I manage to do this with the BobRay's solution.