Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I select a dropdown value and display other value on the label in Powerapp?

I would like to select a dropdown value and then show some other values extracted from the excel datatable on a label. For instance, if I select "Jonathan Soh" in the dropdown list, the text label will show "a". Else if I select "Peter" in the dropdown list, the text label will show "b" and etc.

Below is the canvas-app formula I have tried but it can only select the dropdown list value and show dropdown list value on the text label. Please see the image for better understanding.

If(
    InspectorDropdown.Selected.Value = "Jonathan Soh",
    "Jonathan Soh",
    InspectorDropdown.Selected.'name ')
like image 324
Nix Avatar asked Nov 17 '25 06:11

Nix


1 Answers

You're in the right track with the If function; in your case, you can use an expression like this one for the label:

If(
    InspectorDropdown.Selected.Value = "Jonathan Soh",
    "a",
    InspectorDropdown.Selected.Value = "Peter",
    "b",
    InspectorDropdown.Selected.'name ') // this last value will be used if nothing matched before

In this specific case, if you're always comparing with the same value, you can also use the Switch function, which will make the expression a little easier to read:

Switch(
    InspectorDropdown.Selected.Value,
    "Jonathan Son", "a",
    "Peter", "b",
    "James", "c",
    InspectorDropdown.Selected.'name ') // this last value will be used if nothing matched before
like image 80
carlosfigueira Avatar answered Nov 20 '25 05:11

carlosfigueira



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!