Filtering Resources before processing with Taglister?

I use getResources to produce lists. I use getResourcesTag, from tagLister, to produce tag-filtered sub-lists. Both getResources and tagLister work from the full dataset.

I now want to filter my resources with a non-tagged value so that the tag-filtered list excludes this non-tagged value. This filter would ideally take place before the tag-filtering.

In another way of putting it, I want to exclude some list items from the list to be tag-filtered.

Is there a way to use getResources first (to reduce the dataset) and then tagLister next to produce the tag-filtered sub-lists from only the reduced dataset?

Or is there another way?

Nic Boyde

According to the tagLister documentation “getResourcesTag is a wrapper snippet around getResources, so all the properties in getResources are also available to getResourcesTag.”
So you probably can just use the where-property from getResources in your call to getResourcesTag.

[[!getResourcesTag? ... &where=`{"field:=":"value"}`]]

Thank you for thinking about this.

An interesting idea, so I tried it. It didn’t work, any more than &tvfilters did, also stated to be a getResources property. One caveat: &where isn’t documented fully, so my JSON-like-but-not-JSON coding might be off.

Perhaps I should have mentioned that I am dealing with a TV, my own field, not a MODX standard field. The &where examples all use a standard MODX field (like “template”) with a numeric value, no quotes. My field is a word or words. &includeTVs and &processTVs are both ‘on’.

The &tvfilters works correctly in getResources, but not when it’s wrapped with getResourcesTag.

I’m stuck.

I think the &tvfilters-property doesn’t work, because it gets overriden in the code of the snippet getResourcesTag.
You will have to duplicate the snippet getResourcesTag and append the tvfilters there to make it work.

$scriptProperties['tvFilters'] = $tagKey.'=='.$tag.',othertv==othervalue';

“&includeTVs and &processTVs are both ‘on’.”

I don’t know for sure but if getResources works the same like pdoTools then it shouldn’t be ‘on’ but the name of the TV you want to include.

This is an example of my pdoMenu, i have a TV called ishotlink that returns yes when checked.
I make a menu of this featured resources like so:

 &includeTVs=`ishotlink`
 &where=`[{"TVishotlink.value:LIKE":"yes"}]`

No idea if im helpfull here, but hey i tried.

Thank you for this, but I fear it isn’t possible: there’s something about getResourcesTag that overrides any getResources filter.

getResources doesn’t work like pdoTools. &includeTVs is a simple true:false proposition. Listing included TVs is through another parameter &includeTVList. That said, the parsing within getResources of &where parameters isn’t defined in the docs.

I’ve tested again using &where as you suggest, but the list is returned unfilltered, as it is if I use &tvfilters.

getResources works as described, but fails when wrapped with getResourcesTag fromthe Taglister package.