Is it possible to read fields from related items view, and how?

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
eedoh
Posts: 37
Joined: Tue Feb 11, 2014

14 Mar 2014

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

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

17 Mar 2014

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.

pgmacca
Posts: 1
Joined: Sun Dec 21, 2014

22 Dec 2014

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

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

22 Dec 2014

Hi,

Could you send HTML-source of your form page to support@spform.com?

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

23 Dec 2014

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= $', '');

Katy
Posts: 145
Joined: Wed Dec 02, 2015
Location: Canada

12 Jan 2016

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?

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

13 Jan 2016

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.

Katy
Posts: 145
Joined: Wed Dec 02, 2015
Location: Canada

13 Jan 2016

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.

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

20 Jan 2016

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.

Katy
Posts: 145
Joined: Wed Dec 02, 2015
Location: Canada

13 Mar 2016

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

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 10 guests