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

Question: Format a Number from Sharepoint List into 2 decimal places and commas no matter the input number

I am currently building a flow where an HTML template document is being filled through a series of compose statements and replace expressions within them. They look as follows:

 

replace(outputs('Compose_-_Set_EndDate'), '{TotalCost}', string(body('Get_item')?['TotalCost']))

 

In this case the thing that is being replaced is the TotalCost token with the TotalCost item from the current iteration of an apply to each loop. 

 

The problem is that the Number is formatted to have commas and 2 decimal places in the SharePoint List, however, when it is converted into this Flow it loses the decimal places and commas. For example, 5,456.00 would change to 5456 in the flow and then output as such on the HTML document. I am dealing with these numbers as currencies so they need to be precise to 2 decimals.

Any help would be much appreciated. 

Thanks! 

1 ACCEPTED SOLUTION

Accepted Solutions
jaredt17
Level: Powered On

Re: Question: Format a Number from Sharepoint List into 2 decimal places and commas no matter the input number

A solution I have found is to avoid formatting in Flow at all. Instead, I created a dummy column that holds the formatted number in a string. I used Text(TotalCost,"[$-en-US]$#,##0.00") as a calculated columnn for TotalCost and then used that string information in various places where I needed it. It would still be nice if this can be done in flow but for now I will mark this as a solution since it solved my problem. 

View solution in original post

5 REPLIES 5
Super User
Super User

Re: Question: Format a Number from Sharepoint List into 2 decimal places and commas no matter the input number

If you could provide an expanded screenshot of your Flow and steps, and of any detailed error messages you're receiving we could likely better assist you.

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Community Support Team
Community Support Team

Re: Question: Format a Number from Sharepoint List into 2 decimal places and commas no matter the input number

Hi @jaredt17 ,

 

Could you share the full screenshots of Flow configuration?

If you use int() function or an Integer type variable to store these values, it may lose decimal places and commas.

It is recommended to use float() function or a variable of type Float.

 

In addition, if the number after the decimal point is 00, you could use concat() function to add a decimal point and 00.

Like:

concat(replace(outputs('Compose_-_Set_EndDate'), '{TotalCost}', string(body('Get_item')?['TotalCost'])),'.00')

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
jaredt17
Level: Powered On

Re: Question: Format a Number from Sharepoint List into 2 decimal places and commas no matter the input number

This sounds like a good solution. I am not storing the number in any variable it is coming straight from the sharepoint list which it is stored as a number on. 

Could you give an example condition that would check if the numbers after the .00 are missing or 0? 

 

Here is a screenshot as well...

2bcd3c513dccb348f2afdd7d65b1a5dd.png

 

Thanks!

jaredt173
Level: Powered On

Re: Question: Format a Number from Sharepoint List into 2 decimal places and commas no matter the input number

 
jaredt17
Level: Powered On

Re: Question: Format a Number from Sharepoint List into 2 decimal places and commas no matter the input number

A solution I have found is to avoid formatting in Flow at all. Instead, I created a dummy column that holds the formatted number in a string. I used Text(TotalCost,"[$-en-US]$#,##0.00") as a calculated columnn for TotalCost and then used that string information in various places where I needed it. It would still be nice if this can be done in flow but for now I will mark this as a solution since it solved my problem. 

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,571)