Solved

Create workflow substracting a value in column


I have a column in SharePoint list called [Numbers], what I would like to achieve is to periodically run a workflow that goes thru an items in the list and in the  [Numbers] column it makes a mathematical operation current value in column - 1 then previous value will be replaced by a calculated one.

 

Can you give me any sugestions...

icon

Best answer by ghaiashish 21 May 2021, 17:51

View original

3 replies

Userlevel 2

It is not very clear what you wish to achieve 


You can use 'query list' querying [Numbers] column on entire list upto 5000 items or based on a filter or number


You can use for each to get value of each [Numbers] column


Then use do calculation to subtract 1 from the number and capture in a variable 


Finally use update item action to replace the value of [Numbers] value with caculated value

Just to be much precise column before workflow starts:
[Numbers]
4
6
5
4
...

column after workflow pass:
[Numbers]
3
5
4
3
...
Userlevel 2

Steps I suggested will work


1) Query list for all list items - single output - capture results in a collection variable 'varNumCol'


2) Use for each loop for 'varNumCol' and capture result in a integer variable 'varNumber'


3) use 'do calculation' inside 'for each loop' -  'varNuber - 1' capture in another number variable 'varNewNumber' 


4) Update list item where 'Current Item Number' = 'varNumber',  update '[Numebr]' field to 'varNewNumber'


5) Create a site workflow as a site workflow to start this workflow and add a schedule if you need periodic runs


Hope this makes sense, let me know if you need further help

Reply