Using multiple dropdowns for filters in a table

Hello I have a table with data from a database that I want to filter.
I managed to get it to work with one filter but it doesn’t work with more than one.
Here is the code I use:
import wixData from ‘wix-data’;

$w.onReady(function () {
$w(“#table1”).collapse();
});

export function filterInput_change_1(event, $w) {
if($w(“#table1”).collapsed) {
$w(“#table1”).expand();
}
$w(“#dataset1”).setFilter(wixData.filter()
.contains(“title”, $w(“#filterInput”).value));
}

export function filterInput2_change(event, $w) {
$w(“#dataset1”).setFilter(wixData.filter()
.contains(“competition”, $w(“#filterInput”).value));
}

Can you help me?

Hi Christos,
Are there any relationship between drop down filterinput1 & 2?

Hello Heson,
They are filtering the same table. (filterinput 1 filters one column and filterinput2 the second column)

Hi Christos,
Can you please share a link to your site a specify the name of the page ?
Roi

Hi, did you managed to get this resolved? I would like to know how to filter more than 3 fields within the same database as well.

Has this topic been answered anywhere? I have been struggling with this issue. Trying to filter a collection using multiple fields / columns and display the results in the table. Either a dropdown where users can select a value from the Flow Range field (this field has duplicate values so I would need to eliminate repeated values. i.e., 15 lpm, 25 lpm, 15 lpm, 5 lpm, 25 lpm), a value from the Gas field (also duplicate values i.e., Air, Oxygen, Air, Oxygen) and a value from the Connection field (also duplicate values i.e., Chemetron, Ohmeda, Chemetron, Oxequip, Ohmeda). If a search input box and button are used the search would need to be for any of the terms entered in box. What I have been able to do only returns results in the table that have all of the terms exactly as entered so not much use currently. Any help would be greatly appreciated. Thanks!


// For full API documentation, including code examples, visit http://wix.to/94BuAAs
import wixData from 'wix-data';

export function button24_click(event) {
 const filterValue = $w("#input1").value
 const byTitle = wixData.filter().contains("title", filterValue)
 const byProductDescription = wixData.filter().contains("productDescription", filterValue)
    $w("#dataset1").setFilter(byTitle.or(byProductDescription))
 //Add your code for this event here: 
}

Please add your issue as a new post rather than bumping up an old thread from 2018.

You can check the example pages for duplicates etc.
https://www.wix.com/corvid/examples?page=5

Old post being closed.