pdoResources and TVFilters operator


it seems that a “notlike” operator does not work:


Can someone can tell me why?

It works correctly, when I test it.

Maybe “Ja” is saved as the value 1 in the database? (You could check the database table modx_site_tmplvar_contentvalues).

To see what’s going on, add the property &showLog=`1` to your call of pdoResources, and then verify the SQL query (line “SQL prepared”) in the output.

If I do


It did not work. If I do


It will work. But that is not what I want I want a “not like” operator.
If I add &showLog its write out something like:

... 0=`TVld-grossformat`.`value` NOT LIKE '%Ja%', modResource.parent:IN(4), modResource.published=1, modResource.deleted=0

So from that, it seems that is correct. But it do not.

The TV ld-grossformat is a checkbox with the Value “Ja”

So the problem is, that `TVld-grossformat`.`value` has a value of NULL and NULL is hard to handle in SQL. (Whether you use LIKE or NOT LIKE, a value of NULL never matches.)

I don’t think you can achieve what you want with &tvFilters.
Try using the &where property instead:

&where=`IFNULL(ld-grossformat,'') NOT LIKE '%Ja%'`
1 Like

You could also try adding a random “Default Value” to your checkbox TV.
That forces MODX to create an entry in modx_site_tmplvar_contentvalues for every resource (whether the checkbox is checked or not) and avoids NULL values.

Thank you very much. That Solution do the Job.

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.