Inserting Multiple Objects

Super basic question, I cannot figure it out. How do I insert two separate objects into one individual record of a dataset?

wixData.insert("Dataset", <???????>)
	.then( (results) => {
		let item = results;
	} )
	.catch( (err) => {
		let errorMsg = err;
	} );

Do you mean Objects (like serialized objects) or fields? If last, according to doc it should be:

fieldname1 : fieldvalue1, fieldname2 : fieldvalue2

e.g.

address : myAddress, zipcode: myZipcode

or

address : “Baker Street”, zipcode : “123456”

Thanks for the response Giri. I actually figured it out. Here is what I was trying to do. Essentially, take the records from one dataset, combine it with information on the current user and create a different dataset.


$w("#dynamicDataset").onReady( () => {
	let itemObj = $w("#dynamicDataset").getCurrentItem();

	var obj = Object.assign(user, itemObj);

wixData.insert("Project_Applications", obj)
1 Like

Elegant!

Hi,

need help fast please. I am trying to make a booking site and i am having trouble connecting Paypal process payment.
Is it possible to transfer java to java script…

If possible can you please make a snipet of at least one code. I am quite new to this <3

Hi marketing.eco.rent.split,

Your question has nothing to do with this five-month-old topic, please make a new thread detailing your problems. Java and Javascript are both Turing complete, there’s no theoretical reason keeping you from generating functionally equivalent code in one language vs. the other; however, it looks like what you’ve linked is is showing how to use the various language-specific APIs provided by PayPal. Since external libraries can’t be installed, you would have to use the PayPal REST APIs to interact with their service.