cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

Number formats in Apps (mobile) - calculations

Hi PowerApps community

 

I have some problems how PowerApps interpretes fraction numbers based on language on the iPhone device

Situation: I have simple App, that should show different colors based on definition in my TextInput

So - in valGreen.Default I put 0.985 - as seen on the pictures below

Later, on Fill I have the following formula:

 

If(Value(txtDaily.Text)>=Value(valGreen.Text),Green,If(Value(txtDaily.Text)>=Value(valYellow.Text),Yellow,Red))

Everything works fine on iPhone with English settings

But i noticed, that if the settings are Danish, it doesn't work as expected. Analysing that, I realised that in Danish 0.985 is not fractional number, because in Danish decimal sign is comma, not dot

In fact if I run the App and change my TextInput from 0.985 to 0,985 (note the comma) - it start showing correctly colors

 

My question is - how to put the default correct fraction number in my TextInput, so it works on both English/Danish devices?

 

Capture.PNG

 

 

Regards,

Yakimo

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted

You have the right idea, but a better solution would be

Text(0.985,"[$-en-US]##.000")

depending on the range of numbers you need to support. This says "interpret the period in the format string as a decimal point", then "convert to a string in the user's locale" (Danish in your case).

View solution in original post

Highlighted
Community Champion
Community Champion

Hi @Yakimo

 

@AndyPennellis correct. 

 

Please amend accordingly.

TQ

hpkeong

View solution in original post

6 REPLIES 6
Highlighted
Community Champion
Community Champion

Hi

 

May this link, under Global Apps section and custom format language placeholder

 

https://powerapps.microsoft.com/en-us/tutorials/function-text/

 

gives you a better answer?

 

Hope it helps, TQ

 

hpkeong
Highlighted

Hi @hpkeong

 

I couldn't quite get it

Shall I type in valGreen.Default Text( 0.985, "[$-en-US]", "en-US" )

so the danish iPhone can make the comparison correct?

 

Unfortunatelly I do not have around Danish iPhone, some of my colleagues have, and I cannot test it right away

 

Thanks

Yakimo

Highlighted

You have the right idea, but a better solution would be

Text(0.985,"[$-en-US]##.000")

depending on the range of numbers you need to support. This says "interpret the period in the format string as a decimal point", then "convert to a string in the user's locale" (Danish in your case).

View solution in original post

Highlighted
Community Champion
Community Champion

Hi @Yakimo

 

@AndyPennellis correct. 

 

Please amend accordingly.

TQ

hpkeong

View solution in original post

Highlighted

Hi @hpkeong@AndyPennell

 

Thanks both for suggestions.

I would like to test @AndyPennell's suggestions

Will do that right away tomorrow in the office, where I have colleagues with Dansih iPhones

Before that I cannot amend, sorry

 

Regards,

Yakimo

Highlighted

Thanks for the solution, @AndyPennell

It solved my issues

 

regards,

Yakimo

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (9,502)