What i am trying to do is create a list where i can add entries that staff received for Time Off Awards. In my organization time off awards can not go over 80 hours yearly. I have created a list view that groups the awards by staff name and then totals up how many hours they received. Basically the issue i am having is trying to find a way to subtract 80 hours from the total of time of hours in a group. I feel like there should be a easy way to do this. I have sharepoint designer if this is something that needs to be done using that. I am using SharePoint 2010.

Thank you,

Desperate for an answer


You could create a view page that filters or even groups by "group". Have that view turn on the totals feature "SUM" under the column "Hours". Then, create some javascript that takes the total value from the "Totals" view feature and subtracts 80.

some psuedo code

    var totalhours = document.getElementsByTagName("nobr").innerText.split('=')[1];
    var minuseighty = int.parse(totalhours) - 80;
    document.getElementsByTagName("nobr").innerText = "Remaining=" + minuseighty;

  • unfortunetly I do not know much about code. Is there an easier way to do this? I made the new view, made a group and summed up the group using totals. The column I need to 80 hours to be deducted from is called Remaining Hours. Is there a way you can tell me what the code would be and explain how to copy it into SharePoint Designer to get it to work? I am so frustrated been trying to get this to work for day. – Madeline Faunce Oct 27 '17 at 16:41
  • Make a CEWP above or below the list view webpart for the view. Then add the code above using "Edit Source" in the ribbon – Mike Oct 27 '17 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.