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 II
Super User II

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (72,524)