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 News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,727)