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

Dynamically Change Currency Symbol based on Drop Down Choice

I have a power app that has a drop down menu for a user to choose their currency. The choices are USD, EUR, GPB, and BRL. Based on the selection, I want the two fields below this one to change the currency symbol to match the choice selected. The two fields are text fields. See screen shots below:

 

cjwilson80_0-1660600179968.png

Here, I want the symbols to change based on the choice of the drop down menu above. 

cjwilson80_1-1660600208977.png

 

I have the following code in the text fields OnChange property: Set(varChangeNumber1, Text(Value(DataCardValue22.Text), "[$-en-US]$#,###.00")).

 

Is there some kind of IF statement I can use that says If(Dropdown1.Selected.Value = "GBP", then make the symbol "£"), etc?

1 ACCEPTED SOLUTION

Accepted Solutions
Roverandom
Solution Supplier
Solution Supplier

It seems to me that the controls are text input type. If that's the case, and you want to mask how the data should be typed, in the Hint text property of the controls, put the following codes:

$"
{
    Switch(
        Dropdown1.Selected.Value,
        "BRL", "R$ ",
        "USD", "$ ",
        "EUR", "£ ",
        "GBP", "£ "
    )
}8,000,000,000.00
"

 

$"
{
    Switch(
        Dropdown1.Selected.Value,
        "BRL", "R$ ",
        "USD", "$ ",
        "EUR", "£ ",
        "GBP", "£ "
    )
}10,000.00
"

 

But if the information should appear in the controls as a default value, in the Default property, put the same codes.

Final result:

currency.gif

Explaining:
$"" -> new method to concatenate functions and text, for example. See more here. Other methods, here.
Switch -> use this function when you have to check multiple values



Hi! I hope I was helpfull. Please always mark the answer that helped you, so others who need it will find it faster.



Roverandom is a book by J.R.R Tolkien. I'm a big fan of his works and as Frodo, Aragorn or Gollum are already widely used, I decided to use this nickname.

View solution in original post

4 REPLIES 4
Roverandom
Solution Supplier
Solution Supplier

It seems to me that the controls are text input type. If that's the case, and you want to mask how the data should be typed, in the Hint text property of the controls, put the following codes:

$"
{
    Switch(
        Dropdown1.Selected.Value,
        "BRL", "R$ ",
        "USD", "$ ",
        "EUR", "£ ",
        "GBP", "£ "
    )
}8,000,000,000.00
"

 

$"
{
    Switch(
        Dropdown1.Selected.Value,
        "BRL", "R$ ",
        "USD", "$ ",
        "EUR", "£ ",
        "GBP", "£ "
    )
}10,000.00
"

 

But if the information should appear in the controls as a default value, in the Default property, put the same codes.

Final result:

currency.gif

Explaining:
$"" -> new method to concatenate functions and text, for example. See more here. Other methods, here.
Switch -> use this function when you have to check multiple values



Hi! I hope I was helpfull. Please always mark the answer that helped you, so others who need it will find it faster.



Roverandom is a book by J.R.R Tolkien. I'm a big fan of his works and as Frodo, Aragorn or Gollum are already widely used, I decided to use this nickname.

Hi!

That worked!! Thank you!

Roverandom
Solution Supplier
Solution Supplier

I was going to answer you. Did you manage to solve it?



Hi! I hope I was helpfull. Please always mark the answer that helped you, so others who need it will find it faster.



Roverandom is a book by J.R.R Tolkien. I'm a big fan of his works and as Frodo, Aragorn or Gollum are already widely used, I decided to use this nickname.

Yes, it is solved, thank you!

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (1,721)