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

Conditional Price and Dates formatting

Hello Community  !

I am  creating a multi langage app.  I'm using Excel File + Lookups for translations and everything is ok.
I am having issues with Dates and Prices formats : 

Ex - For prices  
In Poland price would be like "1 500zł"  ; In France price would be like "€ 1500" ; In US price would be lige "$1,500" 

1) When i enter the price format in the Price Text  : everything is ok ( - Text(ThisItem.Price;"[$-PL]# ### zł";"PL") - )
2) When i add the format in an Excel file and use a Lookup with the corresponding country : Nothing happens.  

I would like to Avoid "if country, format, else..."  because anytime i add a new country in my app i will  have to edit the code and change every price and date fields. (In Excel, as for translations, i will just have to add the corresponding lines and renew data source)

Is there a way to format a price depending on a format string stored in an Excel file ? 

Thanks


 

1 ACCEPTED SOLUTION

Accepted Solutions
SG42
Level: Powered On

Re: Conditional Price and Dates formatting

Hello ! 

I finally managed to find why it wasn't working.

I am settingvariables in onload : 

Set(DefaultCurrencyPrefix ; LookUp(DateCurrenciesFormats; Key = "txtCurrencyPrefix" And Lang = userCountry; Value));;
Set(DefaultCurrencySymbol ; LookUp(DateCurrenciesFormats; Key = "txtCurrency" And Lang = userCountry;Value));;
Set(DefaultCurrencyFormatting ; LookUp(DateCurrenciesFormats; Key = "txtCurrencyformatting" And Lang = userCountry;Value));;
Set(DefaultCurrencyCountry ; LookUp(DateCurrenciesFormats; Key = "txtCurrencyCountry" And Lang = userCountry; Value));;

 


Why it didn't work. 
I was first setting Formatting and symbol together ex "$###,###" or "###,###€"  to specify the format and place of the symbol => that was not working
I've split the formatting and symbol and added a 0/1 setting for symbol place.

My Text formula is now  :
If(DefaultSymbolBeforePrice="1";
Text(ThisItem.Price; DefaultCurrencyPrefix & DefaultCurrencySymbol & DefaultCurrencyFormatting ; DefaultCurrencyCountry );
Text(ThisItem.Price; DefaultCurrencyPrefix & DefaultCurrencyFormatting & DefaultCurrencySymbol ; DefaultCurrencyCountry )
)


It's working fine and I can now manage to specify everyting in one Excel File for all countries  🙂

Thanks

View solution in original post

3 REPLIES 3
MrNappa
Level: Powered On

Re: Conditional Price and Dates formatting

The process you describe sounds reasonable enough. Could it be an 'async' issue? ie, maybe the delay in getting the format value makes the display 'miss' the result and not use it. You could easily test this; try for example adding some code in the App.OnStart, and set a global variable ( Set( priceFormat, LookUp( ... ) ). Then use Text(ThisItem.Price,priceFormat) in your gallery.

SG42
Level: Powered On

Re: Conditional Price and Dates formatting

Hello ! 

I finally managed to find why it wasn't working.

I am settingvariables in onload : 

Set(DefaultCurrencyPrefix ; LookUp(DateCurrenciesFormats; Key = "txtCurrencyPrefix" And Lang = userCountry; Value));;
Set(DefaultCurrencySymbol ; LookUp(DateCurrenciesFormats; Key = "txtCurrency" And Lang = userCountry;Value));;
Set(DefaultCurrencyFormatting ; LookUp(DateCurrenciesFormats; Key = "txtCurrencyformatting" And Lang = userCountry;Value));;
Set(DefaultCurrencyCountry ; LookUp(DateCurrenciesFormats; Key = "txtCurrencyCountry" And Lang = userCountry; Value));;

 


Why it didn't work. 
I was first setting Formatting and symbol together ex "$###,###" or "###,###€"  to specify the format and place of the symbol => that was not working
I've split the formatting and symbol and added a 0/1 setting for symbol place.

My Text formula is now  :
If(DefaultSymbolBeforePrice="1";
Text(ThisItem.Price; DefaultCurrencyPrefix & DefaultCurrencySymbol & DefaultCurrencyFormatting ; DefaultCurrencyCountry );
Text(ThisItem.Price; DefaultCurrencyPrefix & DefaultCurrencyFormatting & DefaultCurrencySymbol ; DefaultCurrencyCountry )
)


It's working fine and I can now manage to specify everyting in one Excel File for all countries  🙂

Thanks

View solution in original post

Highlighted
v-siky-msft
Level 10

Re: Conditional Price and Dates formatting

Hi @SG42 ,

It looks that you have got the workaround to your issue.

Could you please click "Accept as Solution" to help other members find it more quickly.

Best regards,

Sik 

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps 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!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

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