GetResources TVFilters

I have sections of a website that lists people on different pages according to their profession(s) such as…

Butcher
Baker
Tailor
Milner
Author
Trainee Baker

They can have more than one profession which means they appear on more than one page.

I’m using the following in a getResources call on the Bakers page…

 &tvFilters=`person-expertise==%Baker%`

But I can’t figure out how to remove the ‘Trainee Baker’ from the page that calls ‘Bakers’

Any input, gratefully received.

There are (complicated) solutions where you include the used separator (usually , or ||) into the search string and then look for values that “start with the search term + separator” OR “end with separator + search term” OR have “separator + search term + separator”.

Another possibility is to use the &where property and a subquery with FIND_IN_SET or REGEXP. Similar to the examples here:


What separator is used in the table modx_site_tmplvar_contentvalues to separate the different values?


Maybe you could also switch to Tagger to assign the professions, which would avoid having multiple values in one field.

As ever Harry - thank you for your input. I didn’t think there would be a straightforward solution and switching to Tagger isn’t possible as it’s an established website and would mean some disruption before a forthcoming audit.

I came up with a ‘not very elegant’ solution which was to populate &resources with a (placeholder) list taken from a second, filtered call that just got the IDs of Trainees.

Not elegant but working. Shows the versatility of MODX and the power of sitting back with a cup of tea!