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 Apps
Answered

Switch If function

(0) ShareShare
ReportReport
Posted on by

Hi I would like to cascade my dropdowns using conditions. Previously, I was able to do it with switch function. On my drpCountry dropdown, when I select a country, drpAvailable will show "No" automatically. Now, I added all the list of countries on my SharePoint list. All countries availability (drpAvailable) except for US is automatically (DefaultSelectedItems) set to No. When I select US in drpCountry, I should still be able to modify the drpAvailable to Yes or No.

 

Below is the code I've used before using the switch function

 

 

Switch(
 drpCountry.Selected.Value,
 "GB",
 {Value: "No"},
 "AU",
 {Value: "No"},
 "CA",
 {Value: "No"},
 "SA",
 {Value: "No"},
 "UAE",
 {Value: "No"}
)

 

 

Categories:
  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @biancadevera :

    Could you please tell me:

    What do these two sentences mean?

    All countries availability (drpAvailable) except for US is automatically (DefaultSelectedItems) set to No. When I select US in drpCountry, I should still be able to modify the drpAvailable to Yes or No.

    If you want the default option of this combo box to be "No" when the user selects "US", then the formula can be written like this:

     

    Switch(
     drpCountry.Selected.Value,
     "GB",
     {Value: "No"},
     "AU",
     {Value: "No"},
     "CA",
     {Value: "No"},
     "SA",
     {Value: "No"},
     "UAE",
     {Value: "No"},
     {Value: "No"}
    )

     

    If you want the default option of this combo box to be "No" only when the user selects "US", and the formula is "Yes" when the user selects other values, the formula can be written like this:

    Switch(
     drpCountry.Selected.Value,
     "US",
     {Value: "No"},
     {Value: "Yes"}
    )​

    Best Regards,

    Bof

  • biancadevera Profile Picture
    on at

    Hi @v-bofeng-msft ,

     

    I was able to improve the logic of my formula. Thanks for enlightening me. So here's what I did:

    I pull the data from my SharePoint list to the drpCountry. Then I used this formula as suggested:

    Switch(
     drpCountry.Selected.Result,
     "United States",
     {Value: "Yes"},
     {Value: "No"}
    )​

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 234 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard