Page 1 of 1
Is it possible to read fields from related items view, and how?
Posted: 14 Mar 2014
by eedoh
Basically, I have a list of contracts, and a list of change orders. There's a lookup field to the contracts in change orders list. I placed related items (change orders) view on the contracts form. I'd like to sum all the change order amounts and add them to the contract value field in the contracts list.
Is this possible, and if so, how??
Thanks
Re: Is it possible to read fields from related items view, and how?
Posted: 17 Mar 2014
by Dmitry Kozlov
Hello,
You can create a view with aggregation and then select it in the Related items settings. Go to the 'change orders' list, click the 'Create View' button on the ribbon, choose 'Standard View', expand 'Totals' section and choose aggregation column.
Next, you should select the new view in the Related items settings in Forms Designer.
And finally, you can copy Total value into the parent field via JavaScript.
Re: Is it possible to read fields from related items view, and how?
Posted: 22 Dec 2014
by pgmacca
I am in the process of evaluating the Forms Designer, and I have been able to get everything to work, except for the ability to copy/ reference the Aggregated total.
Could you please add some information in relation to your last line, as to how to "Copy" the value using Javascript.
TIA
Re: Is it possible to read fields from related items view, and how?
Posted: 22 Dec 2014
by Dmitry Kozlov
Hi,
Could you send HTML-source of your form page to
support@spform.com?
Re: Is it possible to read fields from related items view, and how?
Posted: 23 Dec 2014
by Dmitry Kozlov
Hi,
We've received your message, thank you. Please, use the following code to retrieve the aggreagtion value via JavaScript:
var value = $('.POLineItems .ms-listviewtable > tbody > tr > td:eq(2)').text().replace('Sum= $', '');
Re: Is it possible to read fields from related items view, and how?
Posted: 12 Jan 2016
by Katy
Could you please explain how i can use the same solution for my project? How i can insert name of my related item into this code and field name?
Re: Is it possible to read fields from related items view, and how?
Posted: 13 Jan 2016
by rostislav
Thank you, i've done everything but i am only getting the copy of first number from the related item, not the sum of all numbers.
Re: Is it possible to read fields from related items view, and how?
Posted: 13 Jan 2016
by Katy
In that case you can play around with the number in td:eq(3), increasing or decreasing it. Otherwise, you can send the html of the page to
support@spform.com.
Re: Is it possible to read fields from related items view, and how?
Posted: 20 Jan 2016
by rostislav
Thanks for the reply and sorry for delay.
That didn't help
I did a workaround and included subtotal view on a separate tab as i was in a hurry. It serves the purpose but i would really like to make the Total field work. I'll get back to that issue later.
Re: Is it possible to read fields from related items view, and how?
Posted: 13 Mar 2016
by Katy
1. You related items control must be in client render mode for this code to work
2. Enter a CSS class name for the related items control, we'll use "myitems"
3. Use the following code, replacing "myitems" with your CSS class name, and "3" with the number of the column containing the aggregation number, starting from 0 (not 1).
Code: Select all
$('.myitems .ms-listviewtable > tbody > tr > td:eq(3)').text()
4. The text you'll get back you may have to trim to get only the numeric value