Hi, I’m trying to filter results in a table based on a text input. One text box matched a name with the name column in my database, but I also want to be able to search via member number. I tried simply changing the name search to member number with no luck. I have now tried to connect the table to the dataset then filter by member number but get an error. The two situations are listed below.
//input2 is a text input box with number value
//‘membernumber’ is a database column of numbers
//I’ve tried with and without toString(), thought I had a casting issue
//function returns a blank table
export function button2_onClick(event){
let searchNumber = $w(‘#input2’).value;
wixData.query(‘SeriesDemo’)
.contains(‘membernumber’, searchNumber.toString())
.find()
.then(res =>
{
$w(‘#table1’).rows = res.items;
});
//alternative attempt I connected the database to the table and tried to filter with…
export function button2_onClick(event){
let searchNumber = $w(‘#input2’).value;
$w(“#SeriesDemo Dataset”).setFilter(wixData.filter()
.hasAll(searchNumber)
);
}
For this one I receive the error TypeError: $w(…).setFilter is not a function
Any help is appreciated!