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 / Combo Box if statement
Power Apps
Answered

Combo Box if statement

(0) ShareShare
ReportReport
Posted on by 42

Hello,

 

I was wondering is there a possibility to include if statement in combo box.

 

For instance, I have a list of unique Regions and unique States. It is one to one relationship. 

 

I created  combo box where a state is dependent on a selection in the region. Thus a user can not chose a state before choosing a region. 

I was wondering if I can create a function where if State is selected a corresponding Region will appear but I also want to the user to be able to select a region where a corresponding state will appear. 

 

In the end, I want the final user be able to search based on either Region or state.

 

Best

Categories:
I have the same question (0)
  • TheRobRush Profile Picture
    11,128 Moderator on at

    in your region combobox put something like 

    Switch(
     statecombobox.selected.value,
     "Hawaii", ["Pacific"],
     "Texas", ["South"],
     Blank(), ["Pacific", "South"])

    Then a similar switch in your items of state box

     

    Could also be less typing to set these all up as a collection in the OnStart, and just reference the collection with both comboboxes

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

    Hi @fireflyxxoo,

    Could you please tell me which column type you choose to save the region and state, Single-line-of-text?

     

    Here is what I got form your description:

    1). Region and State has 1:1 relationship in your list

    2). You want to create cascading dropodown based on this relationship

    3). Either you select Region or State, another dropdown could be populated with the corresponding state or region

     

    If the above is correct, here is a solution for your reference(Supposed to be a single-line-of-text column type).

    1). Set the Region dropdown control Items property:

    List.Region

    2). Set the Region dropdown control Items property:

    List.State​

    3). Set the DefaultSelectedItems(for ComboBox) as below:

    If(!IsBlank(ComboBox_State.Selected.State),Filter(List,State=ComboBox_State.Selected.State).Region)//For Region ComboBox DefaultSelectedItems property
    If(!IsBlank(ComboBox_Region.Selected.Region),Filter(List,Region=ComboBox_Region.Selected.Region).State)//For State ComboBox DefaultSelectedItems property

    If you user a Dropdown box instead, you just need to replace the Filter() function with LookUp() function.

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 494

#2
WarrenBelz Profile Picture

WarrenBelz 352 Most Valuable Professional

#3
11manish Profile Picture

11manish 323

Last 30 days Overall leaderboard