cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Subtract two values from two sharepoint columns and then update list item

Hi guys!

 

I am struggling all day with something which should be a piece of cake...but obviously not for me.

 

I have two SharePoint lists and two columns of type "Number".

 

"DateDiff" is a column in List 1.

"VacationDaysRemaining" is a column in List 2.

 

As a last step in my flow, I want to update the value in "VacationDaysRemaining" column with new value which is the result of substracting the "DateDiff" value from the current value in "VacationDaysRemaining".

 

I have tried the following expressions, but everytime I get the same error on this last step:

sub(item()?['VacationDaysRemaining'],triggerBody()?['DaysDiff'])
sub(int(item()?['VacationDaysRemaining']),int(triggerBody()?['DaysDiff']))

 

The error I get is:
"Unable to process template language expressions in action 'Compose' inputs at line '1' and column '2552': 'The template language function 'sub' expects its second parameter to be an integer or a decimal number. The provided value is of type 'Null'."

 

Any help will be highly appreciated!

 

Cheers

1 ACCEPTED SOLUTION

Accepted Solutions

@Anonymous, yes!

That's the formula I am using:

 

sub(items('Apply_to_each')['VacationDaysRemaining'],triggerBody()['DaysDiff'])

 

You just need to pay attention to the specific names of your flow steps and replace the 'Apply_to_each' with the relevant step in your flow. 

Hope this helps!

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Were able to find a solution, i need to do the same.

@Anonymous, yes!

That's the formula I am using:

 

sub(items('Apply_to_each')['VacationDaysRemaining'],triggerBody()['DaysDiff'])

 

You just need to pay attention to the specific names of your flow steps and replace the 'Apply_to_each' with the relevant step in your flow. 

Hope this helps!

View solution in original post

Anonymous
Not applicable

@Medalow, thanks for sharing. My error is resolved, but I ran into another issue the value I get for DateDiif is 512 doesn’t matter what’s in Sharepoint. SharePoint column display the right value in DateDiff column. Can you share the formula you used for datediff if it’s a calculated column for you.

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Users online (9,384)