Is it possible to read fields from related items view, and how?
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
Is this possible, and if so, how??
Thanks
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
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.
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.
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
Could you please add some information in relation to your last line, as to how to "Copy" the value using Javascript.
TIA
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
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= $', '');
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= $', '');
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.
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.
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.
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).
4. The text you'll get back you may have to trim to get only the numeric value
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()
-
- Information
-
Who is online
Users browsing this forum: No registered users and 6 guests