Okay I’ve tried something a little different using the and() function that can combine two queries.
export function searchButton_onClick(event) {
let firstQuery = wixData.query(“allcoinmastercardslist”)
.eq(‘villageLevel’, $w(‘#iTitle’).value)
.or(
wixData.query(‘allcoinmastercardslist’)
.contains(‘title’, $w(‘#iTitle’).value)
);
let commaAfterValue = $w(‘#iTitle’).value + “,”;
let commaBeforeValue = “,” + $w(‘#iTitle’).value;
let secondQuery = wixData.query(“allcoinmastercardslist”)
.eq(‘villageLevel’, commaAfterValue)
.or(wixData.query(‘allcoinmastercardslist’)
.eq(‘villageLevel’, commaBeforeValue)
);
firstQuery.and(secondQuery)
.find()
.then (res=> {
$w(‘#table1’).rows = res.items;
}); }