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

    I'm using getResources to build two colums of unordered lists on a page. I'm trying to filter these getResources on a TV called tv.marker which is a numeric field of 1 to 11. The first one is sopposed to get #1-6 and the second gets #7-11.

    [[!getResources?
      &tpl=`marker.tpl`
      &parents=`[[*id]]`
      &includeContent=`0`
      &includeTVs=`1`
      &showHidden=`0`
      &hideContainers=`1`
      &cache=`0`
      &sortby=`menuindex`
      &sortdir=`ASC`
      &where=`tv.marker<7`
    ]]
    

    [[!getResources?
      &tpl=`marker.tpl`
      &parents=`[[*id]]`
      &includeContent=`0`
      &includeTVs=`1`
      &showHidden=`0`
      &hideContainers=`1`
      &cache=`0`
      &sortby=`menuindex`
      &sortdir=`ASC`
      &where=`tv.marker>6`
    ]]
    


    No matter what I do both getResources snippets return only five items in the list and they are #1-6 which does not match either &where filter.

    I'm stumped. I know I have done something similar before. What am I missing in &where filter?

    Thanks! [ed. note: curmudgeon61 last edited this post 14 years, 10 months ago.]
      • 29597 ☆ A M B ☆
      • 350 Posts
      Try adding
      &limit='0'
      to have more then 5.
        MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
        DESIGNfromWITHIN, MPThemes and Any Screen Size
        Follow me on Twitter | Read my blog | My code on GitHub
        • 6146
        • 48 Posts
        Yes, I have missed that one many times before, DESIGNfromWITHIN.

        I have already tried &limit=`0` and it makes the snippet return all eleven items both times.

        There is some issue with my filter by TV that I cannot seem to figure out from the rtfm docs.

        Thanks!
          • 30319
          • 406 Posts
          I'd like to know how you got this sussed -- I want to do something similar...

          Thank you, Tom
            • 22303 MODX Staff
            • 10,725 Posts
            See the &tvFilters property described at http://rtfm.modx.com/display/ADDON/getResources#getResources-SelectionProperties.

            There are some documentation updates being added for the latest release at this moment; until this release the only way to filter resources was using an == operator which uses a LIKE query. Starting in 1.4.2-pl, you can now use a variety of operators for filtering. Docs should be updated within an hour.
              • 30319
              • 406 Posts
              What about using the nth-something tpl feature??
              Has that been added to the documentation??
              Thank you, Tom
                • 6146
                • 48 Posts
                Thanks opengeek. Figured I was missing something.

                Think I'll solve this by adding a `column` TV and making it either 'left' or 'right' and filter by tv.col=='left' and tv.col=='right'

                Always another way to do somethign in MODx. smiley

                Cheers.
                  • 22303 MODX Staff
                  • 10,725 Posts
                  Quote from: TomMLS at Dec 13, 2011, 09:20 AM
                  What about using the nth-something tpl feature??
                  Has that been added to the documentation??
                  It is now listed in the Templating Properties. Note that tpl_N overrides any tpl_nN that would apply by divisors and that the largest tpl_nN will apply otherwise. Both override the tplOdd, tplFirst, and tplLast properties.
                    • 6146
                    • 48 Posts
                    Thanks opengeek. I just saw your tweet:

                    In case you missed it last week getResources 1.4.2-pl for #MODX Revo features 11 new operators for tvFilters—http://rtfm.modx.com/display/ADDON/getResources#getResources-SelectionProperties

                    I'll give it a go.
                      • 22303 MODX Staff
                      • 10,725 Posts
                      Quote from: curmudgeon61 at Dec 13, 2011, 10:01 AM
                      Thanks opengeek. Figured I was missing something.

                      Think I'll solve this by adding a `column` TV and making it either 'left' or 'right' and filter by tv.col=='left' and tv.col=='right'

                      Always another way to do somethign in MODx. smiley

                      Cheers.
                      FWIW, when filtering on TV's, do not use the tvPrefix; this is only used when setting placeholders for rendering TV's. Just use the name, and do not quote strings, e.g.
                      &tvFilters=`column==left`