Hi there. Is there a way to create a database as shown on website. But have people search for certain parts of data based on location… For example putting in your postcode only shows the stores nearby which have been inputted on the database?
Hey Paul,
Welcome to the Wix Code forum.
Yes, you could search the database but you will need to be able to deal with the postcodes. You can learn how to use Google Maps services which can assist in the handling of the postcodes.
A gentle warning: The system you are describing is quite complex and will be a challenge for beginner coders. You might want to consider checking out the WixArena - it’s a hub where you can look for Wix Code (and other) experts for hire.
Feel free to post any questions here.
Have fun and good luck,
Yisrael
Hello everybody.I have a similar problem or question. I tried to use a filter function to filter the database for address data. The problem with this is that it only works for one place. As soon as you enter other places or postcodes in the search bar, no result comes out. Do you have any idea why that is? I haven’t been at Wix too long, so my assembled code might seem a bit weird.
I use the address app from Wix. Everything is connected to the Maps API.
export function searchBar_keyPress(event) {
$w.onReady(function () {
$w("#loadingGif").show();
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
$w("#dataset11").setFilter(wixData.filter().contains("title", $w('#searchBar').value)
.or(wixData.filter().contains("Address", //<------ $w('#searchBar').value) //<---------This point doesnt work
))
.then(() => {
count();
})
}, 300);
If someone could help me, I would be very grateful.I’ve been trying to solve this problem for weeks.
Thank you in advance
best regards
Phoenix of Music
.contains(value) checks the database for what information you pass to it.
e.g. “Location1, Location2” will only return data which contains the text “Location1, Location2”, not “Location1”, “Location2”. as it is can only search for the string given.
Instead try splitting the search up using something like .split(“,”);
and use multiple .contains for each value you want to be included: