Subform Aggregation (Strings)
There is no built in function that you can call to aggregate strings from an element on a multiple paging sub-form, however the custom function below will handle it nicely.
Copy and paste this function into the Page Level Javascript window of your parent form.
function iformAppendString(myArray, myElement) {
var total = '';
for (var i = 0; i < myArray.length; i++) {
if (total.length > 0)
total += ' , ';
total += myArray[i][myElement];
}
return total;
};
On your parent form you need to call the function within the element where you would like the strings to be aggregated (Text Area elements work well for this). For this example we will assume the following are true.
Parent Form Name: my_parent
Sub-Form Element DCN: my_sub
Text Element on Sub-form: my_sub_text
In the Dynamic Value field of the text area element on the parent level we put the following.
iformAppendString(my_parent.my_sub, 'my_sub_text')
In the Dynamic Value field of the element on the subform level (
my_sub_text
) we put the following.my_sub_text=" "
Comments
2 comments
Can this script be used to aggregate strings from a second level subform to first level subform?
Is there any way to aggregate data from two different elements in the subform? So maybe you had a time element along with a duties performed and in the parent text area element it would be "7:10 AM - Cleaned up mess, 11:29 AM - Prepared site for concrete installation.... etc.
Please sign in to leave a comment.