Leiste mit Community-Erfolgen erweitern.

GELÖST

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 Akzeptierte Lösung

Avatar

Korrekte Antwort von
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
}

Lösung in ursprünglichem Beitrag anzeigen

4 Antworten

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

Level 2

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

Avatar

Korrekte Antwort von
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
}

Avatar

Level 2

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