Hi! Hope you all are safe and well.
I am trying to make a search function for a dataset. I want a search function where the input would check against the entire data of dataset, and not simply one element. I am a novice to coding, still learning.
I researched a bit and found that this might be useful:
import wixData from ‘wix-data’;
export function input1_change(event) {
function query() {
let query = wixData.query(“Research_Scholars”)
query = query.limit(50);
//put here all your query criteria
query.find()
.then((results) => {
$w(“#listRepeater”).data = results.items;
}
}
});
I keep getting the following two errors:
- Parsing error: Unexpected token }
- When I preview, it says: Error parsing web-module ‘public/pages/ep8dp.js’: Unexpected token (13:3) while parsing file: public/pages/ep8dp.js.
Please help!?
Thank you so much!
A lot of times ‘unexpected token’ appears because of the wrong syntax and especially problems with brackets. Sometimes you leave out brackets hence you do not have enough and sometimes you have too many.
The brackets may look correct at first but you have to check that every starting bracket has the ending one and the other way around.
Once you place the cursor next to the opening bracket the code panel will also highlight the ending bracket for you which can be extremely useful.
From your screenshot I can assume that your code has some syntax errors because of this and you have to really make sure you follow the brackets.
other then that - we have a lot of amazing tutorials on searching databases and using queries :
https://www.wix.com/corvid/forum/corvid-tips-and-updates/example-search-a-database
https://support.wix.com/en/article/corvid-tutorial-adding-collection-data-search-functionality
https://www.youtube.com/watch?reload=9&v=Hx7_8-lRsW0
https://www.youtube.com/watch?v=ZiKcx2nlrkw
Thank you so much. Will check the links.