We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37032
    • 64 Posts
    Hi,

    Can someone please provide me with some simple examples of how to use "JSON where expressions conditions" in the manager.

    Let say I would like to filter out only resources that is published, and another example that require "AND", "OR".

    I couldn't find any information or examples about this. In the manager a small text says I can use JSON but that wont do much if you don't know how to use it. wink [ed. note: tomahl last edited this post 14 years, 8 months ago.]
      • 37032
      • 64 Posts
      ..someone able to help?
        • 22303 MODX Staff
        • 10,725 Posts
        What small text says this and where? Are you asking about Form Customization? I don't think anyone understands what you are asking about.
          • 37032
          • 64 Posts
          Sorry my english is not the best. I am going to show you the text/functionality I am referring to instead.

          Create a new TV and choose "Resource List". Below the "Where conditions" field it says:

          "A JSON object of where conditions to filter by in the query that grabs the list of Resources. (Does not support TV searching.)"

          This is what I would like to see one or more examples of. Am I totally wrong here or is not this something you could use for let say, grab all resources that are "published"? [ed. note: tomahl last edited this post 14 years, 8 months ago.]
            • 28215
            • 4,149 Posts
            {"published":"1"}
              shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
              • 16430
              • 217 Posts
              What about filtering wayfinder output using WHERE?
              I need to show only containers that contains resources and hide empty containers. Problem is that some containers contains another containers, that should be hidden as well. Is this possible?
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                You should be able to use the categoryFolderTpl property to deal with your "empty" containers.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 16430
                  • 217 Posts
                  Quote from: sottwell at Feb 27, 2013, 08:00 AM
                  You should be able to use the categoryFolderTpl property to deal with your "empty" containers.

                  OK, but how?
                    • 16430
                    • 217 Posts
                    I was trying for couple of hours figure out hot to show only folders containg some children using categoryFolderTpl, but its hopeless...
                      • 3749
                      • 24,544 Posts
                      Is this Evolution or Revolution?

                      In Evolution, everything with children is automatically a container. In Revolution being a container is manual, you set the Container status by checking a checkbox, which sets the isFolder field whether the Resource has children or not. In Revo, you may be able to set the container status manually to get what you want.

                      I think Wayfinder uses hasChildren() for naviagtion but checks the isFolder field for setting the container classes. I could be wrong.

                      You could write a plugin tied to OnDocFormSave that would set the isFolder field based on the presence or absence of children so Revo would work the same as Evo.
                        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