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 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:
I have the same question (0)
  • Verified answer
    v-bofeng-msft Profile Picture
    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

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 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard