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

Dynamically set number of decimals in a flow

Hello!

 

I am building a flow and one part of it is converting a number in string format (like 5) to have two decimals (5.00). If the number was always a whole number, i could have done something like "hard coding" the zero decimals. But in some scenarios the number will have one decimal already when it enters the flow (like 5.5). In that case i would like the result to be 5.50. To make it a little bit more "complex" it can sometimes have two decimals already when it enters the flow (like 5.55). In that case i would not want to add any decimals to the number. The number will never have more than two decimals when it enters the flow.

 

So i would like to create some kind of dynamic expression to support these scenarios, the value should always have two decimals, and depending on the number that enters the flow (in other words how many decimals it already has, it could be to add 2, 1 or 0 decimals to it.

 

Hope i made the problem formulation clear, any input would be greatly appreciated!

 

//JWP

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Dynamically set number of decimals in a flow

Hi @JohanWP ,

 

It seems that your problem has been solved, please go ahead and mark the post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!

 

Best regards,

Alice       

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Dynamically set number of decimals in a flow

@JohanWP 

I am unaware of any way to accomplish your goal in Power Automate.

You might want to suggest it in the Power Automate Ideas if it isn't already there.

 

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
JohanWP
Level: Powered On

Re: Dynamically set number of decimals in a flow

The workaround i came up with is to check the total length of the string and comparing it with the position (lastIndexOf) of the decimal character. With the position of the decimal sign and total string length known i can define the number of decimals with an if expression

 

//JWP

Community Support Team
Community Support Team

Re: Dynamically set number of decimals in a flow

Hi @JohanWP ,

 

It seems that your problem has been solved, please go ahead and mark the post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!

 

Best regards,

Alice       

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

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

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Users online (6,556)