cancel
Showing results for
Did you mean:
Regular Visitor

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

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.

3 REPLIES 3
Super User III

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 you like my response, please give it a Thumbs Up.

Scott
Regular Visitor

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

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.

Announcements

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

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.

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Top Kudoed Authors
Users online (1,528)