Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Autopopulate / repeat data in the field

Avatar

Level 2

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

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Level 10

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
}

View solution in original post

1 Reply

Avatar

Level 10

Hi,

 

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

Avatar

Correct answer by
Level 10

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
}