Search code examples
powerappspowerapps-canvaspowerapps-formula

TextBox value based off dropdown


I am still very new to using powerapps, but here goes: i have a dropdown that has a list of choices that is pulling from a List-Choice column, with options like A, B, C we will say. based on the dropdown selected i would like to a corresponding text label to show the cost of said choice. example:

dropdown choice        text label value
A                      $100.00
B                      $150.00
C                      $25.00 

any help would be great


Solution

  • In this case you can use the Switch function or the If function. For example, this could be the expression in the 'Text' property of your label:

    Text(
        Switch(
            Dropdown1.Selected.Value,
            "A", 100,
            "B", 150,
            25),
        "$0.00")
    

    Or using the If function:

    Text(
        If(
            Dropdown1.Selected.Value = "A", 100,
            Dropdown1.Selected.Value = "B", 150,
            25),
        "$0.00")