cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Issue adding to previous value of a number field

I'm trying to update a percent complete field. There are three approvers and each one can approve at any time. I'm trying to add to this column and its previous value each time an approval comes through.

 

Ie. Supervisor approves -> i then update it to 33.3%, etc.

 

My first attempt I tried adding the 33.3 to the value of Percent Complete each time an approval comes through. Final approval would add 33.4. Seemed pretty straight forward but i get an error. Here's my workflow:

 

errorworkflow4.PNG

 

The approvals all work but i can't seem to get this running total going for all the approvals. For the adding i used this in the expression window:

 

add(body('Get_items')?['_x0025__x0020_Complete'], 33.3)

- This should add the new value to whatever the previous value was.

 

The error i get is (error disaappears when i remove the adding function and workflow runs fine, but i'd like to have a running percent complete total working):

 

'InvalidTemplate. Unable to process template language expressions in action 'Update_item_3' inputs at line '1' and column '2643': 'The template language function 'add' expects its first parameter to be an integer or a decimal number. The provided value is of type 'Null'. Please see ...

 

Note: I'm doing the adding on a 'number' field within SharePoint (displaying as a percentage). I'm using another list to collect my approvals and then update and aggregate them together on a master list. I know there's easier ways to do approvals but this is what the requirements led us to build.

2 REPLIES 2
Highlighted
Super User II
Super User II

Re: Issue adding to previous value of a number field

@reub77 

Hi there!  I think this makes sense...Your condition path says "If this thing is null, add a number to it", but "null" is not the same as "zero" and the add function wants to see a number before it can add anything to it, right?

My suggestion (there are probably more elegant ways to do this) is to initialize a variable at the beginning and set it to zero.  Then add the 33.3 to the variable in the path and update your % complete to the variable.

 

Another option would be to set the default value in your SP list for that field to "0", if possible.

 

Will that work?

-Ed-

 

If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

New Member

Re: Issue adding to previous value of a number field

I know the screenshot was very hard to see clearly (was trying to squeeze everything in). The test for null is testing the people field's for a value and it works. It will test that it's empty and then proceed to populate it if it is empty. If it isn't empty it means that they are approving the same item again for the a role that has already approved which would not be required and would be ignored.

 

The workflow only errors when i try and add to the value that is currently in the field, which would be zero by default. 

I've updated the above screenshot for clarity.

 

 

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (6,027)