Hi everyone,
I have some work regarding with databases. I just want to connect (merge) two databases according to that user. How can I connect this databases?
Thanks in advance.
Waiting for reply😊
What does mean → connect?
- Are you talking about → concatination of two user-data-packages (ARRAYS) ??
- Are you talking about a → referenced-Field, which is connected to another DB?
- Are you talking about something else?
No exact definition of your question.
No example.
No code!
Not good!
Means I have three databases and and I want required fields from that databases. For example I have A,B and C database. I want two fields from A database, 3 fields from B database and 4 fields from C database. These fields should be it separate out according to user. And create one database of these all fields.
Your issue is similar to this one, but you have data in different DBs instead of different pages.
You can do queries on each of your 3-DBs using Wix-Data-Api.
https://www.wix.com/velo/reference/wix-data/query
After you have generated your 3 queries you run them at once using
promiseAll()
You will get 3 data-packages 1 of each DATABASE.
And the next steps would be similar to the shown post/example.
I just one doubt, can it is possible to connect or merge more databases together according to user?
Of course! This for you have → User-ID and Owner-ID
You will have to filter for it.
using one of the following filter-options…
Or you have another DB-FIELD which is the same on all 3 DBs, then go for it and filter.
First get the unique ID for your USER and then filter all 3 DBs for this ID.
wixData.query(DB)
.eq(FIELD, VALUE)
.contains(FIELD, VALUE)
.hasSome(FIELD, VALUE)
.hasAll(FIELD, VALUE)
.... and some more
.find()
.then((RES)=>{
console.log(RES);
});
Another one more doubt if I have one DB on one site and another DB on second site. Can I connect together?
Thanks
Waiting for reply
You dont’t have any of your DBs on any site.
Your DBs can’t be moved around.
What you have is the DATA out of the DBs (for sure connected by a DATASET, right)?
So if you are working with DATASETS, then you will have to go another coding way.
Then it is not really recommended to mix it with wix-data-api (but still possible).
Back to your question. Your answer you will get in one of the shown LINKS…
Or do you mean a complete ANOTHER SITE ???
If so, you will have to work with Wix-Fetch and http-Functions (END-POINT)
Yes because I have two Razorpay accounts for two sites. And I have some information in database of first site and some information in database of second site. And I required these information together.
Thanks
Waiting for reply
https://www.wix.com/velo/reference/wix-http-functions
https://www.wix.com/velo/reference/wix-fetch/fetch
or you use AXIOS (NPM-INTALL-PACKAGE)
https://axios-http.com/docs/intro
https://axios-http.com/docs/example
I’m beginner at velo coding. No idea how to fetch data or http functions. Can you please guide me regarding my query?
Thanks
Waiting for reply
I can only show you the right door, but you will have to enter this door by your own…
Take a look here…
…should open your eyes!
If you still not able to code this, after reading this post, then you will need someone who will be able to open you your wished door.