I am working on SharePoint 2013 Enterprise.
I am looking for a functionality so I can sum item chosen in a list.
As an example I have a list call Bus which is the parent list.
The second list is the number of passengers which have a lookup column from the Parent or the Bus list.
The functionality that I am looking for is to set #Passenger in parent List depend on passengers belong to that bus. For instant in the example the #Passenger of Bus number 1 should be 3 because 3 people belong this bus.
1 Answer
One way you could do this is to open up SharePoint Designer and create an item workflow in passenger list(triggered on Create or Modified) for the passenger list. Create a parameter in the workflow for each bus type and for add a value to the correct parameter based on some if statements.
Once you have those parameters you could loop through the items on the bus list and update their bus items. Use the Update Item action.
I'll leave you to work out the actual logic on this one, I suspect there is an easier and more elegant method. Certainly, you could also achieve this with some javascript customisation following a similar logic.
Another way, would be to run the workflow and just target the bus item and add or subtract when item is added/updated/deleted.
There may also be a way to do this using calcultated columns, I'm sure that's worth researching.
-
Thanks for your answer! Actually I already tried workflow or JavaScript but I believe always there is a better but hidden way in SharePoint! For sure I will try your solution and researching. May 16, 2016 at 9:53
-
1No problem, other than calculated columns, workflows and javascript are pretty much your only options client side. If you can write javascript then you can easily write a script to handle this, just go back through your logic and see if you can find another approach. Good luck!– GrantMcWMay 17, 2016 at 4:44