cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
darrenfloyd666
Post Prodigy
Post Prodigy

Formatting the number from a Compose action into a whole number

Morning

 

I'm trying to get the numbers from two SharePoint fields to use in a subtraction expression.

 

The one field is coming in fine, but the other value is coming back as 2.0000000000 (see below) which is causing the expression to throw the following error: "Unable to process template language expressions in action 'Days_Remaining' inputs at line '1' and column '37863': 'The template language function 'sub' expects its second parameter to be an integer or a decimal number."

 

How do I format the output so that it returns a whole? I've just tried changing the number of decimal places on the SP field to 0 but it still comes back with 2.000000000000. all help appreciated.

number of days requested.png 

1 ACCEPTED SOLUTION

Accepted Solutions
Jcook
Super User III
Super User III

Hello @darrenfloyd666 

 

Please try the int() expression.

 

This can be used inside the compose action. inside the ( ) put the dynamic value of the number.


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

4 REPLIES 4
Jcook
Super User III
Super User III

Hello @darrenfloyd666 

 

Please try the int() expression.

 

This can be used inside the compose action. inside the ( ) put the dynamic value of the number.


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

Thanks @Jcook  

 

The name of the Dynamic Value is 'Holiday_allocation'. If I type 'int( )' in the expression I can't see it in Dynamic Content only Body and Values, and if I just type 

int(Holiday_allocation)

in the expression field I'm getting the 'expression is invalid'. Where am I going wrong?

Hi @darrenfloyd666 

 

So this seems to be a formatting issue,

 

Can you try and create another Compose action below the first one.

So now you will have 2 compose actions,

 

1 for storing the dynamic value for Holiday_allocation.

and in the second Compose, use the int() expression and put the outputs of the first compose in the ( )


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





Actually that worked! The expression was 

int(triggerOutputs()?['body/Number_of_dates_requested']) Thanks. Got a separate issue but that's another matter.
 
Thanks @Jcook 

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (3,510)