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

    This is a noob question.

    I have a set of resources in Modx Revolution 2 rc. And on my startpage I use the getResources add-on to fetch the resources into a jQuery slider. But I don’t want all the resources to display, just the ones with a TV (radiobutton) set to "true". So if the TV returns "false" the resource should be skipped.

    I have understood that this can be done with the tvFilters property in getResources. And I have tried the following:
    &tvFilters=`in_slider==true`

    But this does not work. I guess I’m using wrong syntax or something obvious, but I have tried to figure this out by myself for the past hours and failed, so does anyone know what I’m doing wrong here?

    This is my in_slider TV:
    Input Type: Radio Options
    Input Option Values: true||false
    Default Value: true
    Output Type: String

    Thanks
      • 3749
      • 24,544 Posts
      It seems to me that that should work.

      Do you have these in the tag?

      &includeTVs=`1` &tvPrefix=``



        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
        • 4172
        • 5,888 Posts
        I think getResources filters only raw data with its sql-query. default-value is not included in filtering-query.
        So you have to set all your TVs explicit to true if you want to filter them with getResources. Or try it with Ditto.
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 22303 MODX Staff
          • 10,725 Posts
          Quote from: Bruno17 at Apr 15, 2010, 11:41 PM

          I think getResources filters only raw data with its sql-query. default-value is not included in filtering-query.
          So you have to set all your TVs explicit to true if you want to filter them with getResources. Or try it with Ditto.
          You have to process every instance of a TV in order to filter on the processed value, which is horribly inefficient. getResources is not intended for this usage and would require massive changes to implement properly. It would be better to create a component for the specific purpose to keep the overhead as low as possible on such a filter (or try Ditto as suggested).
            • 16815
            • 49 Posts
            Thanks for the replies smiley

            I’ve now got it working. I think it was the default value which ruined it. When I removed default value and set the TV in the resources manually, it worked. I also added &tvPrefix=`` to my getResources.

            Quote from: OpenGeek at Apr 16, 2010, 08:45 AM

            You have to process every instance of a TV in order to filter on the processed value, which is horribly inefficient. getResources is not intended for this usage and would require massive changes to implement properly.

            What is proper use of &tvFilters if this is inefficient?
              • 22303 MODX Staff
              • 10,725 Posts
              Quote from: leaase at Apr 16, 2010, 11:32 AM

              Quote from: OpenGeek at Apr 16, 2010, 08:45 AM

              You have to process every instance of a TV in order to filter on the processed value, which is horribly inefficient. getResources is not intended for this usage and would require massive changes to implement properly.

              What is proper use of &tvFilters if this is inefficient?
              That is the proper use; it relies on raw values (vs processed values) stored for each Resource directly in the database. IOW, @INHERIT (and other @ bindings) or any dynamically calculated value for a TV is not meant for use with getResources tvFilters option.
                • 16815
                • 49 Posts
                Thanks again smiley It all works smoothly now.