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.
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
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
201 | |
71 | |
51 | |
49 | |
20 |
User | Count |
---|---|
261 | |
123 | |
86 | |
79 | |
72 |