I am trying to figure out how to use a site workflow to keep running balances on Travel estimated expenses, and actual expenses incurred in different parts of the organization. Each part of the organization has a different travel budget allocation. When a traveler requests approval to travel from the home office, they provide an estimated of the cost of the trip. Then trip is approved by the home office, the site workflow should reduce that particular organization's travel allocation by the estimated cost of the trip. A number of travelers may be requesting approval to travel a the same time, so each prospective traveler within the same part of the organization should see on the request form their organization's remaining travel funds based on requests that have been made and approved before theirs. (I think I have the form figured out). After the trip is completed the traveler will input the actual cost of the trip and the organization's travel budget is again adjusted accordingly by the site workflow. So I need the workflow to update a list with a running tally of each organization's estimated and actual trip expenses.
Based on what appeared to be a similar question posted previously to this site, here's what I ended up with.
Site workflow is
set variable varTotalEstimatedAmnt = 0
set variable varTotalActualAmnt = 0
Query List - Query List A two collection variable colEstimated & colActual
For Each - Target Collection = colPending - store result in varCurrEstimatedAmnt, store index in varIdx
Math Op - varTotalEstimatedAmnt = varTotalEstimatedAmnt + varCurrEsitmtedAmnt
Collection Op - target collection = colActual, Get operation, index = varIdx, store result in varCurrActualAmnt
Math Op - varTotalActualAmnt = varTotalActualAmnt + varCurrActualAmnt
-- End of loop
Update Item
The workflow runs but I can't get that running total. Thanks if you are able to help