Good morning. I am looking for some advice regarding a strange reaction/occasional error
I got a database filter setup that works great sometimes,sometimes at all.
I realised that the problem starts when I start the search with the first two fields,if i start filtering from the price fields than the whole filter works fine
import {wixData} from ‘wix-data’;
export function button1_click(event, $w) {
let searchValue = $w(" #locationSearch ").value;
$w(" #dataset1 ").setFilter(wixData.filter()
.contains(“bathrooms”, $w(’ #dropdown1 ‘).value) //problem when I start filtering with this field
.contains(“bedrooms”, $w(’ #dropdown2 ‘).value)
.contains(“propertyType”, $w(’ #dropdown5 ‘).value)
.contains(‘propertyAddress’, searchValue)
.between(“purchasePrice”, parseFloat($w(’ #dropdown3 ‘).value), parseFloat($w(’ #dropdown4 ').value)))
.then((results) => {
console.log(“Dataset is now Filtered”);
$w(" #repeater1 ").data = results.items;
})
.catch((err) => {
console.log(err);
});
$w(“#repeater1”).expand();
}
export function dropdown5_change(event, $w) {
SubCatFilter();
}
function SubCatFilter (){
$w(" #dropdown6 ").enable();
$w(" #dataset2 ").setFilter(wixData.filter()
.eq(“typesOfProperties”, $w(“#dropdown5”).value)
);
}
The question is,why this could happen and how could I solve it?
Will post the code in the comments
Read through the documentation about filtering but couldn’t find any idea