Hi there! I have a great idea but struggling with how to make it possible.
On the website I created to database collections: before verification and after verification .
Here is the idea description:
Step 1: Users submit their information through user input fields. Right now it successfully goes to before verification database . This information is available in the form on the dynamic admin page and not to other users before verification. I successfully made this step!
Step 2: Admin should make sure that the information from the user is correct. Once he clicks the āapprovalā button I want the information to transfer from before verification to after verification database that sends information to the dynamic page available to all users. I donāt know how to complete this step.
Problem: Before verification and after verification databases have read&write settings. Right now the admin page takes the information from before verification database . I created the submit button and connected it to after verification database . Unfortunately, when the admin clicks the approval button (meaning submit this information to after verification database ) it creates the blank row in the after verification database and do not move the information from before the verification database.
Quick question regarding this code. Is there a way to specify you only want certain items from the first collection to be transferred to the second one? A way without adding all of them? Thanks!
Only add the dataset for the Enroll_provider collection.
You should disconnect and remove the dataset for āProvidersā, since we are accessing it directly with the code.
Also, it is not possible to call insert() on a dataset
Change the names as follows, note that collections and datasets are two different entities:
let toInsert = $w("#replaceWithDatasetName").getCurrentItem();
wixData.insert("replaceWithCollectionName", toInsert)
I did the exact same thing you told me and it still does not work. Sorry if I am a problem.
Database 1: Enroll_provider. The page that loads all the items from the Enroll_provider database uses dataset āEnroll_provider Itemā
Database 2: Providers
The button that I click to transfer data has id: verify and onClick event name: verify_onClick
I deleted the dataset for āProvidersā from the page.
After I included this code the following error exists: TypeError: $w(ā¦).getCurrentItem is not a function
import wixData from 'wix-data';
export function verify_onClick(event, $w) {
let toInsert = $w("#Enroll_provider Item").getCurrentItem();
wixData.insert("Providers", toInsert)
.then( (results) => {
console.log("done adding item")
} )
.catch( (err) => {
let errorMsg = err;
} );
}
The dataset name is incorrect: let toInsert = $w("#Enroll_providerItem").getCurrentItem();
Change to: let toInsert = $w("#Enroll_provider").getCurrentItem();
Slava! Iām so glad you asked this! This is a great idea, and Iām doing something similar. Thanks for being a āproblem,ā so that I donāt have to be one! LOL!
Hello, I have the almost the same requirement as here, but quite didnāt worked for me. I have a huge database collection, and I have a search bar to retrieve those data in a repeater. But, in my case, I just want to move the data that I retrieved in a repeater using button to the next database, and let other remains within the same old collection. I used this code, and I found that only the very first row of data gets transferred into another database, which in my case should be modified. Any helps would be highly appreciated!!