cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JR-BejeweledOne
Super User
Super User

Default Selected Items for Combobox

I have a cascading setup where there is a dropdown with a list of countries and a multi-select combobox with a list of associated regions.   There is also a checkbox that allows all regions to be selected.

 

When an item is selected to be edited from the gallery, the regions combobox is populated with the selected regions in the gallery item.   

 

I am trying to add having the checkbox selected if all the regions are present in the gallery item and if it is unchecked have the regions in the multi-select combobox clear out.

 

Regions Combobox defaultselecteditems formula:

Filter(
    Filter(Regions, crc39_Country_1.crc39_name in ComboBoxCountry.Selected.crc39_name && Use = "Yes"
    ),
      EditItem && ( crc39_name in varRecord.Region) || CheckboxAllRegions.Checked
   )

 

Checkbox formula:

If( CountRows(Filter(Regions, Country.Name = ComboBoxCountry.Selected.Name && Use = "Yes")) = CountA(Split(varRecord.Region,";"))-1, true, false)

 

When EditItem is true and a gallery item is selected that contains all the available regions, the checkbox is checked as well.   At this point I want the user to be able to uncheck the checkbox and clear the selected regions from the regions combobox. 

 

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
1 REPLY 1
WarrenBelz
Super User
Super User

@JR-BejeweledOne ,

Firstly if your Combo Box is multi-select and you do not want Delegation warnings, you could do this

With(
   {
      wList:
      Filter(
         Regions, 
         Use = "Yes" &&
         EditItem && 
         (
            crc39_name in varRecord.Region || 
            CheckboxAllRegions.Value
         )
      )
   },
   Filter(
      wList,
      crc39_Country_1.crc39_name in ComboBoxCountry.SelectedItems.Name
   )
)

Your Check Box Default could be this (you do not need the true/false)

CountRows(
   Filter(
      Regions, 
      Country.Name in ComboBoxCountry.SelectedItems.Name && 
      Use = "Yes"
   )= 
   CountA(
      Split(
         varRecord.Region,
         ";"
      )
   )-1
)

but if the checkbox is CheckboxAllRegions, you will probably get a Circular reference - so you may not be able to inter-relate them as changing the control will affect its own default.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,821)