Hi everyone, I want to sync one dataset with another dataset … let me explain, I want for example: when I add something in dataset1, dataset2 automatically has the same as dataset1
If somebody can help me please
Do you already use some code?
Or do you have done all your connections in the wix property-panel with the help of datasets? I assume you have done it without code and your problem now will be, that you can not connect 2 different datasets to one button-action?
Your first DATABASE is already working? Does it already save data in your first DB? Surely you have connected your SUBMIT-BUTTON with your dataset and setted it up as → SUBMISSION-PROCESS, which writes all your data into DB1.
Now you want to get a second DB → DB2 also filled with the same values? Creating a dublicate-DB? If so, your problem will be (like already mentioned) that you can not connect a second dataset to the already connected button, right?
So in this case you will need code, whcih will do the work.
$w.onReady(()=> {
$w("#myDataset").onReady(()=> {
$w("#myDataset").save();
$w('#mySubmitButtonIDhere').onClick(()=>{
$w("#myDataset").setFieldValues( {
"title": "New Title",
"name": "New Name"
});
});
});
});
The orange marked VALUES, you then can replace with your input-values…
$w('#myInputElementID1here').value
$w('#myInputElementID2here').value
Modify and expand this example for your own usecase.
Thanks my friends i’ll test it now!!
well…that doesn’t seem to work, maybe i didn’t explain myself correctly so
I connected my database1 to a repeater
And i connected my database2 to a another repeater
and i connected my database2 to a form and i want to sync my database2 with my database1 for the database1 show what i’ve type in the form like the first screenshot
I hope you understand what i mean and you can help me🙏🏾!
@ticho-lama1
You are talking about 2x databases, can i see the 2x databases?
Please make a screenshot of both databases.
Sorry, but this is not exactly what i was asking for.
I need to see the sctructure of the 2 involved DBs.
Open your DBs and make a screenshot of the INSIDE of the DBs, especialy the involved DB-Fields.
ohh i got you
It still not really clear for me what you want to achieve.
Why you separate the data into 2x Databases`?
However, i think you are looking either for a REFERENCE-FIELD or INCLUDE…
https://www.wix.com/velo/reference/wix-data/wixdataquery/include
https://www.wix.com/velo/reference/wix-data/queryreferenced
You normaly also should be able to do it with a help of dataset.
Cause i want 1 Database to show what people submit from the form and an another database to allow the editing… i don’t know if you understand what im saying tell me if not