Related Items Sum
-
- Posts: 10
- Joined: Fri Mar 03, 2017
Hi Dmitry,
I have created a few test lists to strip back what I was doing. I have attached the findings from running f12.
Thanks
Jennifer
I have created a few test lists to strip back what I was doing. I have attached the findings from running f12.
Thanks
Jennifer
- Attachments
-
- SnipImage.JPG (36.09 KiB) Viewed 4835 times
-
- Posts: 10
- Joined: Fri Mar 03, 2017
Please see the parent list with the project cost field and the child list with the costs that I want to add up.
Thanks
Jennifer
Thanks
Jennifer
- Attachments
-
- image 2.png (9.18 KiB) Viewed 4835 times
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Please, use the following code:
Code: Select all
var total = 0;
var rows = fd.relatedItems(0).data('ctx').ListData.Row;
rows.forEach(function(item) {
total += parseFloat(item['Cost.'])
});
alert(total);
-
- Posts: 10
- Joined: Fri Mar 03, 2017
Thanks! I got this to work in my sandbox. I am wanting to do the calculation on the Display Form. I can get the pop up with the total but when it comes to inputting the total into a field it doesn't work. Is this because its the Display View?
Thanks
Thanks
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
You cannot update a field in a Display form. But you can replace its display value:
fd.field('FieldName'),control()._el().html(calculatedValue);
fd.field('FieldName'),control()._el().html(calculatedValue);
-
- Information
-
Who is online
Users browsing this forum: No registered users and 26 guests