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’;
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:
}