Trying to figure out a way to create a filter on a repeater that involves a few sets of selection tags. The issue I am running into is that I want to only sometimes apply the filter and some of the filters are negative. I tried looking at the examples in the API documentation but the .not() condition under filters only talks about queries.
export function selectionTags1_change(event) {
$w( ‘#dataset1’ ).setFilter(wixData.filter()
.hasSome( “col1” ,$w( ‘#selectionTags1’ ).value)) //only if there is at least 1 tag selected
.not(hasSome( “col2” ,$w( ‘#selectionTags2’ ).value))
.hasSome(…)
}
this works just fine for the simplest example with the first .hasSome. However what I also want is that if none of the tags are selected it is ignored so that particular .hasSome is not used.
I think for the dynamic part I can just do it in a few steps instead of trying to do it all at once.
var newFilter = wixData.filter()
if ($w( ‘#selectionTags’ ).selectedIndices[ 0 ] !== null ){
newFilter = newFilter.hasSome(propertyName, value)
}
and just build up the filter with the needed components. However I am not seeing any way to handle the inverse filter where it should exclude what has been selected. Am I missing something with the .not? it appears to only handle queries