How to add or() to WixDataFilter ?

I try to use or() in dataset setFilter(). But found that it doesn’t work. The code is following. Hope to get help to resolve this problem. Thank you !

import wixData from ‘wix-data’ ;

$w.onReady( () => {
$w( “#dataset1” ).onReady( () => {
$w( “#dataset1” ).setFilter( wixData.filter()
.eq( “path” , “A1” )
.or(
$w( “#dataset1” ).setFilter( wixData.filter()
.eq( “path” , “A2” )
)
)
.then( () => {
console.log( “Dataset is now filtered” );
} )
. catch ( (err) => {
console.log(err);
} );
} );
} );

let filter1 = wixData.filter().eq("field", value);
let filter2 = wixData.filter().eq("field2", value2);
let finalFilter = filter1.or(filter2);
$w("#dataset1").setFilter(finalFilter)
.then(() => {
$w("#dataset1").refresh();
console.log("Dataset is now filtered");
}).catch(err => err);

Thank you very much, it works perfectly now.

You’re welcome :slight_smile: