AnsweredAssumed Answered

Adding all values that correspond with an employee in one list, then updating a single item with that total in another list corresponding with that same employee

Question asked by rmc1223 on Sep 3, 2014
Latest reply on Jul 20, 2018 by mark.viglione

Struggling with how to do this. I am making a PTO system that has two lists. One that works as a simple leave request system, and one that is used to keep track of how much PTO each employee has accrued for the year and how much they have still available to take.


Most of it is done. The part I still need to do is create a workflow that sums all of the approved hours that each employee has in the leave request list, then puts that total in the Available PTO list so it can be subtracted from the accrued PTO column to give a value of remaining PTO. The lists look something like this:


PTO Requests

Employee            Hours Requested      Approval Status

John                              8                         Approved

Chris                             8                         Rejected

John                             40                        Approved

John                              8                         Pending

Chris                             16                        Approved

Emily                             4                         Approved

Emily                             8                         Approved


I need the workflow to determine that John has 48 approved hours, Chris has 16 approved hours, and Emily has 12, then update the other list with these totals so that employees can see this list filtered to themselves on the PTO landing page :


Available PTO

Employee          PTO Accrued to Date      Approved Leave       PTO Hours Remaining

John                            115                              48                       67

Chris                            35                               16                       19

Emily                           12                                12                        0


I've tried some combinations of Query Lists and For each loops but to no avail yet. Any help would be tremendously appreciated.