web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Switch Statement in Dr...
Power Apps
Answered

Switch Statement in Dropdown

(0) ShareShare
ReportReport
Posted on by 5,331 Moderator

I want to 'Switch' the options available in a Dropdown depending on the content of the same Dropdown.

Dropdown (In Gallery1) -
Default: ThisItem.Color (populated default is "Blue").
Items: ["Blue","Red","Green"]

Switch Action Required: If Dropdown equals "Blue" list choices are "Blue","Red","Green"
                                       If Dropdown equals "Red" choice is "Green"
                                       If Dropdown equals "Green" choice is "Red"

Current Switch Statement I'm trying in Dropdown 'OnChange'. However, when I choose an item on the list the options do not change in accordance with my switch.

At this point the default content of Dropdown1 is "Blue" - I click 'OnChange' in which in which is the following -

Switch(Dropdown1.SelectedText.Value,
     "Blue"
      [{Value: "Blue"}, {Value: "Red"}, {Value: "Green"},

      "Red"
      {Value: "Green"},

      "Green"
      {Value: "Red"})

Categories:
I have the same question (0)
  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @Phineas,

    Could you please share a bit more about your scenario?

     

    Set a variable for OnChange property:

     

    Set(varItems,Dropdown1.Selected.Value)

     

    Write the Switch() in the Items property:

     

    Switch(varItems,
     "Blue"
     ["Blue","Red","Green"],
    
     "Red"
     ["Green"],
    
     "Green"
     ["Red"])
    

     

     

  • Phineas Profile Picture
    5,331 Moderator on at

    Currently I have in Drodown1:
    Dropdown1 - Items: ["Blue","Red","Green"]
    Dropdown1 - Default - ThisItem.Colors

    The above default "Blue" into Dropdown1 and provides a list of the three colors to choose from.

    I've followed your recommendations; When I updated Dropdown1 as follows no default content appears and no list of items is available.

         1. I placed the variable in Dropdown1 'OnChange'

                  Set(varColorChoices,Dropdown1.Selected.Value)

         2. I placed the Switch in Dropdown1 'Items'.

                 Switch(varColorChoices,
                      "Blue",
                      ["Blue","Red","Green"],

                      "Red",
                      ["Green"],

                       "Green",
                       ["Red"])

    With the above update nothing appears as default, and nothing appears in the list.

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @Phineas,

    I have seen that you have solved this issue here, I will mark here to close this case.

    Thanks for your cooperation.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard