cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TBuente
Resolver I
Resolver I

Collect on checkbox default change

Hi All,

 

I currently have an app that allows users to select terms with definitions that outputs into a PDF. This will help users create a "cheat sheet" of any definitions they may need for completing their work. 

 

Currently, I am trying to add the feature of selecting a sub category, which will select all terms within that sub category. (See example below)

ExamplePowerApps.png

 

In this example, if users select "Surveillance", all of the terms will check. I have this part done, simply changing the default values for "Video Surveillance Systems", "Radar Imaging Systems" and "Thermal Imaging Systems" upon "Surveillance" being selected. Currently, when a checkbox is selected, the term, along with a definition and other helpful information, is collected, this is done in the OnCheck and OnUncheck (for removing the term). 

 

While my function to check all of the terms in a sub category is working great, I seem to be having troubles collecting the terms in the sub category selected, only the sub category itself ("Survellience") is being collected. If I select each term individually, the collection works; however, the whole point of the feature I am adding is so users do not have to select each term individually.

 

I was thinking a possible ForAll could work for this, but is hoping someone may have a recommendation on this. 

 

Thanks all!

2 REPLIES 2
Drrickryp
Super User
Super User

Hi @TBuente 

I don't think you need a ForAll() function.  You may be able to accomplish your goal by using the OnCheck property of the master Category checkbox to activate the Select() function that will then select the subcategory checkboxes. So in the OnCheck of the master checkbox control 

 

Select(Checkbox2);Select(Checkbox3);Select(Checkbox4);UpdateContext({var:true})

 

Each subcategory checkboxes would have a Collect() in their own OnSelect() properties to gather the data into the collection.  The UpdateContext() function at the end is to show that the subcategory checkboxes were activated, the Default property of the subcategory checkboxes would be var and in the OnVisible property of the screen, UpdateContext({var:false}) so that they were not checked when the screen becomes visible. 

Thank you for the suggestion; however, I failed to mention that these checkboxes are all in the same gallery. I have tried doing something like:

If(ThisItem.SubCat = "Example SubCat", Select(Checkbox1))

From there, I have tried using the OnSelect to collect the information; however, the only items collected are the original term selected (Surveillance), multiple times. 

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (1,813)