When working with Power Apps, one common requirement is the ability to select multiple items from a gallery. Whether it's for sending emails, updating records, or just enhancing user interaction, adding select and multi-select options to your galleries can significantly improve your app's functionality. In this post, we'll dive into how you can integrate checkboxes for item selection and manage dynamic UI elements in your Power Apps galleries.
Below you will find the necessary steps to create a basic multiple select gallery experience. If you would like to see a more detailed demonstration with more advanced functionality like, Select All and Deselect All then check out the Power Apps video Power Apps Select Multiple Items in A Gallery
Adding Checkboxes to Galleries
The most typical user experience for Selecting Multiple Items is to use a Gallery control in Power Apps. The repeating nature of the controls makes building a scrollable experience very painless. The process is broken down into ____ steps.
First, add the list of choices as a table to your gallery. Design the gallery to look the way you want with the necessary information the user will need to find their choice(s). If you don't readily have the options available in a table you can make one with the shorthand format of
["Choice 1", "Choice 2", "Choice 3"]
as an example. That would go in the Items property of the Gallery. In the video example I used a Table from a Data Source.
Now, insert a Check Box control into the gallery. You will know you have done it correctly if the Check Box shows up on each row even though you only added it once. This is best part about galleries, the automatic repeating nature. Also, now clear out the Text property of the Check Box and then drag it over to the left side of the gallery.
Believe it or not, you are done with building the gallery. Now your users can check or uncheck the items in the gallery. Congrats. Of course, since they can select multiple we should probably cover how to get the items out.
Getting the items they have selected in the gallery
You can get the Table of items that they selected by using Filter and the galleries AllItems property. Assuming your gallery is named Gallery1 and your Checkbox is CheckBox3 use a formula like this in a Label to see how many items are selected.
CountRows(Filter(Gallery1.AllItems, Checkbox3.Value))
Boom! Assuming you now understand that the table that is produced by the Filter is the items you want you can now do whatever you would like with their selections. Most likely saving them with a ForAll and/or a Patch but that is totally up to you.
You could also add Select All and Deselect All but that is covered in the video.
If you need help adding this functionality to your Power Apps or with other challenges let us know. We are here to help, fill out the contact form at the bottom of the page. We offer help anywhere from 30-minute video calls all the way through 30-month projects, let us know how we can help.
If you prefer to learn on your own. there is a downloadable app included with this video in our YouTube training library for only $15/month!
Comments