We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37108
    • 80 Posts
    I'm having issues with the filtering in the following call:
    [[getImageList?
    	&tvname=`item-image`
    	&docid=`[[+id]]`
    	&where=`{"active:=":"1","context:!=":"hero-"}`
    	&toPlaceholder=`interchange`
    	&outputSeparator=`,`
    	&tpl=`interchange-images`
    ]]
    

    I tried "context:NOT LIKE" at first and, upon examining the migx class, saw that perhaps it should be "context:!=". However, this and any variation of adding the wildcard "%" to either or both sides of the string does not work. Note that the field context has no relation to modx's context. Any ideas?

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

    • discuss.answer
      • 4172
      • 5,888 Posts
      this are the avaliable options:
      https://github.com/Bruno17/MIGX/blob/master/core/components/migx/model/migx/migx.class.php#L2079

      For your case, you can create a snippet 'containsnot' like that:

      return strpos($subject, $operand) === false) ? '1' : '0';
      


      and call it like that:

      &where=`{"context:snippet:containsnot":"hero-"}`
      




      [ed. note: Bruno17 last edited this post 10 years, 6 months ago.]
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 37108
        • 80 Posts
        Thanks so much Bruno ... that takes care of it. I'm amazed by how quickly you get back with everyone! It'd be nice to be of some help to you someday. Be well.
          • 44580
          • 189 Posts
          Bruno, would you consider adding LIKE and NOT LIKE to the available options for an old SQLer like me?
            • 4172
            • 5,888 Posts
            @gissirob

            its not really a LIKE or NOT LIKE
            It is just looping the array and searching by
            strpos, if the field contains the searchterm or not.

            If you need real SQL-searching, put the items in a custom-table and use MIGXdb and migxLoopCollection instaed.
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!