@goblingraphics
This happens, when i copy&paste your given CODE (which was not used with the CODE-TAGS). As you can see, this code is now just some piece of sh… xDDDD.
Totaly destroyed.
import wixData from'wix-data';//---------------------------------- USER-INTERFACE --------------------//var DATABASE = "RealEstate" //--> NOT USED HEREvar DATASET = "#dataset1"var REFERENCE1 = "bedrooms"var REFERENCE2 = "price"var REFERENCE3 = "bathrooms"//------------------------------- User-Interface-------------------------------var itemCountvar totalItemCount$w.onReady( () => { $w(DATASET).onReady( () => { console.log($w(DATASET).getCurrentPageIndex())// $w('#TXTseitenanzeige').text=($w("#dataset8").getCurrentPageIndex()).toString() } );} );exportfunction dropdown1_change(event) {SEARCH_ENGINE()}exportfunction dropdown2_change(event) {SEARCH_ENGINE()}exportfunction dropdown3_change(event) {SEARCH_ENGINE()}exportfunction button2_click(event) {SEARCH_ENGINE()}exportfunction dropdown5_change(event) {SEARCH_ENGINE()}asyncfunction SEARCH_ENGINE() { let filter = wixData.filter() let item1, item2, item3, item4if ($w('#dropdown1').value!==0) {item1 = $w('#dropdown1').value}if ($w('#dropdown2').value!==0) {item2 = $w('#dropdown2').value}if ($w('#dropdown3').value!==0) {item3 = $w('#dropdown3').value}if ($w('#dropdown5').value!==0) {item4 = $w('#dropdown5').value}if (item1!==0) {filter = filter.ge(REFERENCE1, item1)} if (item2!==0) {filter = filter.ge(REFERENCE3, item2)}if (item3!=="" && item4!=="") {filter = filter.between(REFERENCE2, item3, item4)}await $w(DATASET).setFilter(filter)}
Please use CODE-TAGS for CODEs!
Like this… (now you can read the code again!)
import wixData from 'wix-data';
//---------------------------------- USER-INTERFACE --------------------
var DATASET = "#dataset1"
var REFERENCE1 = "bedrooms"
var REFERENCE2 = "price"
var REFERENCE3 = "bathrooms"
//------------------------------- User-Interface-------------------------------
$w.onReady( () => {
$w(DATASET).onReady( () => {
console.log($w(DATASET).getCurrentPageIndex())
});
});
export function dropdown1_change(event) {SEARCH_ENGINE()}
export function dropdown2_change(event) {SEARCH_ENGINE()}
export function dropdown3_change(event) {SEARCH_ENGINE()}
export function button2_click(event) {SEARCH_ENGINE()}
export function dropdown5_change(event) {SEARCH_ENGINE()}
async function SEARCH_ENGINE() {
let filter = wixData.filter()
let item1, item2, item3, item4
if ($w('#dropdown1').value!==0) {item1 = $w('#dropdown1').value}
if ($w('#dropdown2').value!==0) {item2 = $w('#dropdown2').value}
if ($w('#dropdown3').value!==0) {item3 = $w('#dropdown3').value}
if ($w('#dropdown5').value!==0) {item4 = $w('#dropdown5').value}
if (item1!==0) {filter = filter.ge(REFERENCE1, item1)}
if (item2!==0) {filter = filter.ge(REFERENCE3, item2)}
if (item3!=="" && item4!=="") {filter = filter.between(REFERENCE2, item3, item4)}
await $w(DATASET).setFilter(filter)
}
Ok, you have ‘#dropdown3’ and ‘#dropdown5’ rwhere you want to filter BETWEEN two values right? As you said it will be the PRICE (ok).
How are setted-up your input-fields in DB and how are setted-up the related two dropdowns for the price? → STRING or NUMBER? (be careful).
item3 = $w(‘#dropdown3’).value (OK) → NUMBER or STRING ???
item4 = $w(‘#dropdown5’).value (OK) → NUMBER or STRING ???
REFERENCE2 = “price” (OK) → NUMBER or STRING in DATABASE ?
Do a little TEST…
if (item3!=="" && item4!=="") {filter = filter.between(REFERENCE2, item3, item4)}
replace with…(manual testing)
if (item3!=="" && item4!=="") {filter = filter.between(REFERENCE2, 50.000, 100.000)}