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

Notifications

Announcements

Community site session details

Community site session details

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

Switch Statement in Dropdown

(0) ShareShare
ReportReport
Posted on by 5,325 Super User 2025 Season 2

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
    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,325 Super User 2025 Season 2 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
    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard