Page 1 of 1

Count and sum fields from related items table

Posted: 16 Nov 2016
by Jaydius
Is it possible to count the number of records in a related items table, and then use the total value to populate a form field e.g. 'Total Related Items'?

Also, is it possible to sum a number field from all related items and also use that totalised value to populate a form field, such as 'Total Hours'?

Re: Count and sum fields from related items table

Posted: 17 Nov 2016
by Dmitry Kozlov
Here is how you can get data from the related items control:

Code: Select all

fd.relatedItems(0).data('ctx').ListData.Row[0].Title
where the first index is 0-based index of the Related Items control in a page, the second – index of the row in the Related Items control, and Title is the internal name of a field.

Just sum values from the required column and put it into a field.