Hi everyone !!!
I am having a query which I thought and thought, coded and coded, but didn't get the solution
Here it is ~>
1) Query one database.
2) Get the results.
3) Query the results to another database.
4) Assign it to repeater's data.
For example ~>
After the first query of the database "numbers", the result got is - > '1' '2' '3' '4' '5' '6'
Then, I want to query the result ('1' '2' '3' '4' '5' '6') to other database called ~> "digits".
Then, get the results.
Then, assign it to the repeater's data.
Thanks!
Ajith
Thanks Yisrael!!
Here is the final code ~>
import wixData from 'wix-data'; import wixUsers from 'wix-users'; $w.onReady(function () { let user = wixUsers.currentUser; let userId1 = user.id; let ucitems = [] let allMessages = []; let myNewData = []; wixData.query("UserContacts") .eq("userId", userId1) .find() .then((results) => { ucitems = results.items; for (var i = 0; i < results.items.length; i++) { allMessages[i] = ucitems[i].userUserid myNewData.push({ "_id": ucitems[i]._id, "userUserid": ucitems[i].userUserid}); } console.log(allMessages); console.log(myNewData); wixData.query("allUsers") .hasSome("userId", allMessages) .find() .then((resultsi) => { let items2 = resultsi.items; console.log("items2 " + JSON.stringify(items2)); $w('#repeater1').data = items2; }); }); });
The console is probably empty since your code is incorrect. You have a number of errors in your Javascript. As an example:
allMessages[i] = [ucitems[i].userUserid]
The errors are probably causing your code to terminate. In addition, you also need an onItemReady() function for your Repeater.
You will need to debug your code to determine where to find why it isn't running. See the article Corvid: Testing and Debugging Your Code. to learn the techniques of debugging Javascript and Corvid.
We are unable to provide full code solutions. Wix provides many resources to help users learn how to get the most out of Corvid. First, you will need to learn the basics of Javascript. I would suggest visiting the following sites for information on programming in Javascript:
https://www.w3schools.com/js/default.asp
https://javascript.info
To learn about programming with Corvid, read the following articles that will help you start working with Corvid:
About Corvid by Wix - what Corvid is and what features it has.
Getting Started with Corvid by Wix - step-by-step tutorial on how to start using Corvid.
Onboarding to Corvid by Wix - introduction to Corvid with short tutorials.
If you find that you are having difficulty with code and need assistance, you may want to check out the Wix Marketplace - it's a place where you can look for Corvid experts for hire.
You can use the result from the query of the first collection in a .hasSome() or .hasAll() filter. Not sure if that's what you want, but that's one example of what you could do.