We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10896
    • 76 Posts
    I’m attempting to filter out of ditto results a portion of docs in the middle of the result set. The tv I’m working with is ’courseid’. The results go from 100 level courses to 999. Then there are letter courseids that show up at the end like MIF, PP, etc. So without a filter the results are like this

    100
    200
    300...

    ...999
    AAA
    BBB
    CCC
    etc.

    I want the following removed from the ditto results

    courseid <= 999 && courseid >= 600

    As far as I can tell there is no way to perform an AND using the ditto filter. What am I missing?

    Thanks
      • 18397
      • 3,250 Posts
      Currently, there is no support for native AND filtering. Please file a ticket in the bugtracker (use the link in my signature).
      If you need it ASAP, you could write it as a quick custom filter. See the example extender for more information.
        • 10896
        • 76 Posts
        Mark,

        I submitted to the bug tracker.

        Can you help me with writing a custom filter? Is there any wiki info on that?

        Thanks,
        -bryan
          • 18397
          • 3,250 Posts
          Take a look at the example extender. It has an example custom filter that should get you started.
            • 10896
            • 76 Posts
            Mark

            I did start looking over the example extender. Looking at the code, I think there’s a steep learning curve in understanding extenders. That’s why I was asking if there is any tutorials or wiki pages to help make the leap a bit smaller.

            Is there any additional help you can offer?

            Thanks

              • 25663 MODX Staff
              • 12,272 Posts
              Likely not until final exams are over with... smiley
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 11975
                • 2,542 Posts
                Hi,

                that’s weird that you cannot achieve this result with the existing filters

                your request is => documents where 600 <= courseid <= 999

                &filter=`courseid,600,5|courseid,999,6`

                Perhaps I’m missing the point but I guess this should do the trick

                :-)
                  Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                  • 10896
                  • 76 Posts
                  heliotrope

                  thanks for the help. I’ve tried that exact filter and that would be the solution if the two statements could have an AND relationship. The problem is that the ditto filters all have an OR relationship. So that filter filters out anything that is less than 999 OR anything that is greater than 500. Which means everything is filtered out. smiley

                  It would be nice if I could swap the ’|’ character for something like ’&&’ to make an and relationship. I know things would get complicated quickly as someone would eventually need nested comparisons (ex: (( x == 4) && ( y > 4)) || (z < 19) ).

                  I’m still open to using a custom extender I just may need a bit of help getting started.

                  Thanks!

                    • 11975
                    • 2,542 Posts
                    I will give this a try because I have this kind of features in tvExplorer where you can define RANGE to search values beetwen two values.
                    In your case courseid between [600-999].

                    I will let you know if I get a solution.

                    :-)

                      Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                      • 10896
                      • 76 Posts
                      heliotrope

                      Wondering if you were able to come up with anything yet?

                      Thanks