Send Total of Child List to Parent List
-
- Posts: 10
- Joined: Fri Mar 03, 2017
Hello,
I have a parent list called Projects for example. I have a child list called tasks which is linked to the parent list with a unique project ID. I want to calculate the total of all related child tasks and input the project total into the parent list. Example shown below:
Parent List - Projects
Project ID Project Name Project Total
000-001 Project a £15.00
Child List - Tasks
Related Project ID Task name Task total
000-001 Task 1 £10.00
000-001 Task 2 £5.00
Thanks
Jennifer
I have a parent list called Projects for example. I have a child list called tasks which is linked to the parent list with a unique project ID. I want to calculate the total of all related child tasks and input the project total into the parent list. Example shown below:
Parent List - Projects
Project ID Project Name Project Total
000-001 Project a £15.00
Child List - Tasks
Related Project ID Task name Task total
000-001 Task 1 £10.00
000-001 Task 2 £5.00
Thanks
Jennifer
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi,
You can calculate the total either in a workflow or with JavaScript directly in a 'Project' form containing a Related Items control with the related tasks. Please, find a sample in the thread:
viewtopic.php?f=1&t=592
If you need an assistance of our support team, send a request to support@spform.com
You can calculate the total either in a workflow or with JavaScript directly in a 'Project' form containing a Related Items control with the related tasks. Please, find a sample in the thread:
viewtopic.php?f=1&t=592
If you need an assistance of our support team, send a request to support@spform.com
I am using the following code and Forms Designer 3.0.1.1. The code does not seem to set the var rows, any help?
var total = 0;
var rows = fd.relatedItems(0).data('ctx').ListData.Row;
rows.forEach(function(item) {
alert('Loop');
//total += parseFloat(item.Amendment_x0020_Amount)
});
alert(total)
var total = 0;
var rows = fd.relatedItems(0).data('ctx').ListData.Row;
rows.forEach(function(item) {
alert('Loop');
//total += parseFloat(item.Amendment_x0020_Amount)
});
alert(total)
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi,
Most likely, Forms Designer 3.0.1.1 does not support fd.relatedItems method. Please, expand the browser console (F12) and check the errors.
Most likely, Forms Designer 3.0.1.1 does not support fd.relatedItems method. Please, expand the browser console (F12) and check the errors.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi,
Could you provide a screenshot of your form with the Related Items control?
Could you provide a screenshot of your form with the Related Items control?
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi,
Most likely, you retrieve an incorrect list view. Try to open the form in a browser, expand the browser console (F12), and type in the Console tab:
fd.relatedItems(0).data('ctx').ListTitle
Then change index in the 'relatedItems' to find the correct view.
Most likely, you retrieve an incorrect list view. Try to open the form in a browser, expand the browser console (F12), and type in the Console tab:
fd.relatedItems(0).data('ctx').ListTitle
Then change index in the 'relatedItems' to find the correct view.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Are you sure that you put the code into the right form? I've just tested the following scenario in both, dialog and non-dialog modes, and everywhere it worked fine:
1. Inserted the code into the form:
alert(fd.relatedItems(0).data('ctx').ListTitle);
2. Tested in a dialog.
3. Tested in the non-dialog mode.
1. Inserted the code into the form:
alert(fd.relatedItems(0).data('ctx').ListTitle);
2. Tested in a dialog.
3. Tested in the non-dialog mode.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 26 guests