Hi is there any way to show a price range (number value) as text in the results?
My real estate search feature includes 2 dropdowns for min price and max price (value is number as per the database) and results are shown on a repeater connected to the database. Of course the results display as a number but I wanted to them to look like this: €100,000 instead of this: 100000
My code is
.between("price1",parseFloat($w('#dropdown5').value), parseFloat($w('#dropdown6').value)))
I've tried using .ge (min price) and .le (max price) but can't seem to get it to work
Thanks
Anyone able to advise? I'm stuck on this final part of the puzzle so that I can finally publish my website
Hi thanks for the assistance with this it was working well until I started to add more items to my database. So the problem I have is the search includes options for sale/rent, location, property type, bedrooms, min price and max price. So now when clients search for say an apartment for sale in location A, with 3 bedrooms between €200,000 to €300,000 the results show all apartments in location A regardless of the price. How do I change the above code so that only properties within the price range specified show in results? Thanks again for any help :)
Wow thank you Mustafa! Will have a go at this. Thanks again
Hi,
Regarding naming the price, you can add static symbol before the text, Ex:
$w("#text").text = " € " + $w("#theValue");
For the range issue, here is how it goes with .ge AND .le :
export function Search_click(event, $w) { let firstValue = parseFloat(($w("#dropdown1").value)); let secondValue = parseFloat($w("#dropdown2").value); wixData.query("DatasetName") .ge("price", firstValue) .le('price', secondValue) .find() .then( (results) => { console.log(results.items); // will show the result of the filtering } ) .catch( (error) => { console.log(error) } ); }
For more information about the repeater and how to fill out the data, please check THIS Good Luck! Best, Mustafa