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 ')
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With