In my last post ( https://www.wix.com/code/home/forum/community-discussion/how-to-access-an-element-in-an-array ) I managed to solve my problem thanks to @tony-brunsman , but now a new problem arises. I have a different database that contains fields related to other details of the user that PrivateMembersData doesn’t have. Currently I don’t know of a way to add/manipulate fields in this pre-created database, so I need to know a way to link this to another database so I can then use that database to show data in my website.
Cant you just add both data sets to the page and link the elements to them? as needed? i have a members profile page that has data on it pulled from 3 different data bases.
Thanks @fraser , but how would you display them? Because each database for me has unique _id fields in them…
This is what I have
PrivateMembersData
| First Name | Last Name | ID |
| A | B | 1as-d4s-d |
Database 1
| First Name | Last name | Score | ID |
| A | B | 50 | 54-dp2-w6 |
For my dynamic page I have my URL to include the ID field (it was the only unique field I got). So that’s where I got my problem. If the link loads using one of the ID, only the database that has that ID will show the data, but not both. Did you set your url to be a different field?
Something like this querys the database 1 on the last name (Assuming its unique) and finds the related score in the other database and returns it to a score box on your page from there you can submit it wherever you like.
wixData.query(“MyFoods”)
.eq(“Database1”,$w(‘#Lastname’).value) //This is your pages element box that contains users last name
.find()
.then( (results) => { let items = results.items; let item = items[0]; let Score = item.Score;
$w(‘#yourscoreelementboxname’).value = item.Score.toString();
console.log(Score);
} )
. catch ( (err) => { let errorMsg = err;
console.log(errorMsg);
})
}