cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Medalow
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
Medalow
Frequent Visitor

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!

View solution in original post

3 REPLIES 3
Nikhilsharma8
Frequent Visitor

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
Frequent Visitor

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!

View solution in original post

Nikhilsharma8
Frequent Visitor

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
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

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!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (7,458)