Autopopulate / repeat data in the field | Community
Skip to main content
March 8, 2022
Solved

Autopopulate / repeat data in the field

  • March 8, 2022
  • 2 replies
  • 1388 views

I want to create a form where the data in one field repeats in another field in the form. The problem is that I want to add multiple new instances and each time the data is different.

 

I've tried to do it with scripting and it worked somehow, but when I wanted to implement it to the existing form, the data from the first example repeated in every row. 

 

I attached example that is working and the one that is not working.

 

https://drive.google.com/drive/folders/12sWmoge1yRSQayfFsQNIJUsdB-ccECcC?usp=sharing

 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by radzmar

So you want to copy the information of each row unter DETAILS into the related row unter RETURN OF ITEMS I guess: Put this calculate script into the object "ReturnOfItems" an remove the other calculations script fromt the text fields.

var nCount = _Enter1.count, // Count instances
	oThat = this; // Create a reference to this
for (var i = 0; i < nCount; i += 1) {
	var oSource = form1.resolveNode('details[' + i + ']'), // Resolve nth instances of source subform
		oTarget = oThat.resolveNode('Enter1[' + i + ']'); // Resolve nth instances of target subform
	// Now copy the data
	oTarget.TextField1.rawValue = oSource.WRAP.EXNAME.TextField.rawValue;
	oTarget.No1.rawValue = oSource.WRAP.BAG.TextField2.rawValue;
	oTarget.TypeOfMedia1.rawValue = oSource.WRAP.TypeOfMedia.rawValue
}

2 replies

radzmar
March 8, 2022

Hi,

 

the link doesn't provide a download or only for registered users. I don't know, doesn't work for me.

magda93Author
March 9, 2022

Oh, so sorry.

 I placed it on the google drive: https://drive.google.com/drive/folders/12sWmoge1yRSQayfFsQNIJUsdB-ccECcC?usp=sharing

Hopefully it works now.

 

Thanks

radzmar
radzmarAccepted solution
March 9, 2022

So you want to copy the information of each row unter DETAILS into the related row unter RETURN OF ITEMS I guess: Put this calculate script into the object "ReturnOfItems" an remove the other calculations script fromt the text fields.

var nCount = _Enter1.count, // Count instances
	oThat = this; // Create a reference to this
for (var i = 0; i < nCount; i += 1) {
	var oSource = form1.resolveNode('details[' + i + ']'), // Resolve nth instances of source subform
		oTarget = oThat.resolveNode('Enter1[' + i + ']'); // Resolve nth instances of target subform
	// Now copy the data
	oTarget.TextField1.rawValue = oSource.WRAP.EXNAME.TextField.rawValue;
	oTarget.No1.rawValue = oSource.WRAP.BAG.TextField2.rawValue;
	oTarget.TypeOfMedia1.rawValue = oSource.WRAP.TypeOfMedia.rawValue
}
magda93Author
March 10, 2022

It's working! Amazing, thank you so much!