cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nightfall
Helper I
Helper I

string to float and decimal separator (or how 4€ become 400€)

Hi all, it's surely a stupid question, but i have the following issue:

i get amounts in string format (e.g. 4,00€ - four euro). in converting it into a number i use the float() function. However, it seems like float() recognizes the comma as the hundreds separator, and thus transforms it into 400.

Is there a way to fix it keeping my locale?

 

Thank you and best regards,

 

Vittorio

1 ACCEPTED SOLUTION

Accepted Solutions

Hi again @Pstork1 and thank you for your suggestion.

I was actually trying to solve it through the very same formatnumber() you mention, however as you pointed out not only it requires a numeric input, which i solved with exactly the same combination float()+replace() that you mention, but also it returns a string! and i'd be forced to go again with float() that would again complain of the ',' 🙂 

However, in trying to solve the technical issue, i lost track of the goal, that is, to provide a sharepoint document set column with a float number. this means that it does not matter how the float arrives localized in the column, as the output of the column will be localized according to the site's settings!

I've therefore solved it with 

float(replace(outputs('TOTDETR_VS'),',','.'))
that will be accepted by float() without changing the amount.
 
Thank you anyway for your support!
 
Happy new year!,
 
Vittorio

View solution in original post

4 REPLIES 4
Pstork1
Dual Super User III
Dual Super User III

What is the Locale setting for your Power Automate environment?  YOu can find that in the Power Automate settings under the Gear menu



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

Hi @Pstork1 ,

thank you for your prompt reply.

I have noticed it, and before writing the post i've switched it from US/english to Italian. However, it gives the same result (i've tried now again and before posting here earlier on).

I was hoping there was a sort of refresh time to wait, but it seems not the case... 

Pstork1
Dual Super User III
Dual Super User III

There may not be a refresh time, but the setting may get embedded in the flow or the connections when they are created.  Try creating a new flow and converting the value.  Also is this a column from a SharePoint list?  If so, then it may be picking up locale from there also.

 

One last thought.  There is also a Format Number action available in Power Automate.  With that you can control the region used for the formatting.  The problem is that requires a numeric input.  So you may have to do something like the following.

formatnumber(float(replace("66,76",',','.')),'##,##',locale)


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

Hi again @Pstork1 and thank you for your suggestion.

I was actually trying to solve it through the very same formatnumber() you mention, however as you pointed out not only it requires a numeric input, which i solved with exactly the same combination float()+replace() that you mention, but also it returns a string! and i'd be forced to go again with float() that would again complain of the ',' 🙂 

However, in trying to solve the technical issue, i lost track of the goal, that is, to provide a sharepoint document set column with a float number. this means that it does not matter how the float arrives localized in the column, as the output of the column will be localized according to the site's settings!

I've therefore solved it with 

float(replace(outputs('TOTDETR_VS'),',','.'))
that will be accepted by float() without changing the amount.
 
Thank you anyway for your support!
 
Happy new year!,
 
Vittorio

View solution in original post

Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

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

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (43,234)