Hi everyone,
I've started dealing with Databases. I'm designer so I don't have much idea on this.
I have created a Database or Dataset with a list of people, addresses, Telefon numbers, etc... The thing is that I need to create a search tool that goes to that database and shows the results in a table with all the fields. For example, I type Germany and I get a table with all the members living in Germany, with names, telephone numbers, etc... Actually something very simple... but not for me :-)
Here is the address of the web I need to re-design with the "old" search engine. Just look for FIND A STRINGER NEAR YOU section under the homepage photo.
http://www.ersa-stringers.com/
Thanks in advance for your help
Create an input field, a button, a table to display result import wixData from "wix-data"
export function button1_click(event) {
wixData.query("collectionnamehere")
.contains("title", $w("#input1").value)
.find()
.then(res => {
$w("#table1").rows = res.items;
});
}
$w.onReady(function () {
$w("#table1").columns = [{
"id": "name",
"dataPath": "title",
"label": "Name",
"type": "string",
}, {
"id": "fname",
"dataPath": "fatherName",
"label": "Father Name",
"type": "string",
}];
});
any help
Hi Nayeli,
Thanks for replying, i have changed (C) to small, but still not working
Line 12 ..... you have a capital "C"
Your database does not start with a capital letter.
Hi Yisrael
Thank you for your reply and help,
I couldn't figure it out, could you please explain in detail. thanks
Hi,
Your problem is that you have your table connected to a dataset, and you are trying to set the rows from a query at the same time. You should choose only one method. If you want to use the dataset, then you can set a filter on the dataset. If you prefer working directly with the collection using wix-data, then you should do a query and set the rows to the query results.
I would suggest reviewing the documentation on Database collections, and on connecting to a collection using Datasets.
You might also want to read the tutorial How to Use Code to Let Your Users Search a Collection which will guide you step by step to do exactly what you want.
Good luck,
Yisrael
https://academic11.wixsite.com/oatc/certificates
Please post the URL of your site. Only authorized Wix personnel can get access to your site in the editor.
I have create a databse with this code, but when i type in the search textbox and click search button nothing is showing. please help
Hi everyone,
I am creating a database with columns: Name, District and Blood Groups. Now I want to display the search results of the people of a particular district with a particular Blood Group. What should be the code? The 'or' code is not working. Please help!
Thank you in advance.
Hey getsetmg,
I told you Nayeli has some great stuff. Glad you got it working.
And for the tutorials, you can thank the tutorial team at Wix. They do a really great job.
Yisrael
Hi Nayeli,
it works!! thanks so much!!
And also thanks Yisrael for the nice tutorials!!
Hey getsetmg,
First off, @Nayeli has great stuff available so take a look. Watch her video, but maybe eat first 😉.
I was going to explain about databases, collections, datasets, binding, and so on, but there is a very nice video which does a great job of explaining the terminology and more importantly, how to use it. Take a look at Working with Datasets in 5 steps.
There are also a number of other very useful tutorials available the Video Tutorials page.
And - you can of course ask here in the forum if something isn't clear or doesn't work for you.
All the best,
Yisrael
Hi getsetmg,
Have you you checked out this Search code video? It could possibly help you, link to video: https://www.youtube.com/watch?v=ZdIB0Q7WXP4&list=PL16sLBOBeiCPRFb05oERA0LtYheIyPoAR
Link to forum article: https://www.wix.com/code/home/forum/questions-answers/search-a-database
If you are looking for a different type of search function, in this forum search for the words: filter dataset, filter table, search table
Happy coding!