cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Medalow
Level: Powered On

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
Medalow
Level: Powered On

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

@Nikhilsharma8, 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!

3 REPLIES 3
Nikhilsharma8
Level: Powered On

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

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

Medalow
Level: Powered On

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

@Nikhilsharma8, 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!

Nikhilsharma8
Level: Powered On

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

@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
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 368 members 4,544 guests
Please welcome our newest community members: