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
MVP

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
MVP

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





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
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,512)