Notifications
Announcements
Hi,
I am using checkbox inside a gallery and when a checkbox is checked, it stores its value in CDS using relate function but I have found out that it unchecked itself .
Any solutions on how to retain its checked state.
Thanks
@Rohit03 ,
If the checkbox is not "bound" (its Default is not a field in the collection or list the gallery is based on), then any code run from inside the gallery will reset it to its Default value (which I suspect is false). The only way to avoid this is to have a field in the data (in a collection you simply add a Boolean field and patch the checkbox value to it when changed), then have the Default of the checkbox bound to this field.
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
You have to set the default value of your checkbox test if your records are allready relatedIf you are viewing Table1 item, stored in a variable and your gallery is showing Table2 items, you can set the default value to :VarTable1.Table1 in ThisItem.Table1.Table1Be carreful with this, because default value change can trigger oncheck and onuncheck events
Hi, can you please provide the sample code.
Happy to correct your attempt at it - please post in Text using all of your values including where you are using it. You also need a collection as the data source.
I have a checkbox inside a gallery and its value is from courses table, when a checkbox is checked ,I want to write all the checked values in another table(tags) in CDS and it is working fine but the problem is that whenever I checked the checkbox , it unchecked itself but I want the checkbox to retain its checked state when it is checked.
So far I am not able to find solutions to this problem.
Not sure why you re-posted your original question - if you have a collection for the gallery Items, use AddColumns to add the extra field, then Patch the checkbox value to it OnCheck and OnUncheck. The Default of the Checkbox is then ThisItem.YourNewFieldName. I just needed your structure and field names and you will understand the code better if you attempt it first.
I have tried adding a collection when a checkbox is checked which is inside a gallery, however in a collection there is only the last selected value. How can I get all the multiple selected values. There is only one checkbox in a gallery.
If your collection contains only one item with More than one checkbox is checked :
Maybe you use clearcollect() function in your checkbox (ClearCollect : clear the collection and add new records)
Use collect() instead, to add a record to your collection and elsewhere, when you need to flush the collection, use clear()
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
In our never-ending quest to improve we are simplifying the forum hierarchy…
We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
WarrenBelz 765 Most Valuable Professional
Michael E. Gernaey 343 Super User 2025 Season 2
Power Platform 1919 272