Would you like to work with the Check box control within the Power Apps gallery? If so, then this Power Apps tutorial will guide you on how to achieve this. We will also cover the following topics based on different scenarios.
- Power Apps checkbox add from gallery to collection
- Power Apps Select All checkbox in the gallery
- Power Apps gallery checkbox multiple selections
- Power Apps reset checkbox in the gallery
- Power Apps set checkbox value in the gallery
- Power Apps Gallery Checkbox disable
- Power Apps Gallery Checkbox count
- Power Apps Gallery Checkbox single select
- Power Apps Gallery Checkbox disable based on time
- Power Apps checkbox filter gallery
Power Apps checkbox add from gallery to collection
In this example, we will see how to add the check box selected item(s) from the Power Apps gallery to a Power Apps Collection. That means when the user selects any checkbox item(s), the selected items will be stored in a collection. Similarly, when the user unchecks the items from the checkbox control, the individual item will be removed from the collection.
To work with this requirement, the following steps are:
- Suppose we have a SharePoint list named Projects having a Title column.
- On the Power Apps environment, add a vertical gallery. Set the layout as Title to display only the title of the SharePoint list.
- Then add a check box control to the vertical gallery. Insert the below expression on the checkbox’s Text property.
Text = ThisItem.Title
Now we can see, the check box has the data from SharePoint’s Title field shown below:
- Next, insert the below expression within the checkbox’s OnCheck property, where we will create a collection to store the checked values from the gallery.
OnCheck = Collect(CollProjects,ThisItem)
Where CollProjects is the name of the collection name.
- Similarly, to remove the item from the collection once the item is unchecked insert the below expression on the OnUncheck property of the checkbox control.
OnUncheck = Remove(CollProjects,ThisItem)
Let’s preview the app and check some checkbox items from the gallery.
We can see these checked items will be visible in the CollProjects collection.
Let’s uncheck some items from the gallery again.
We can see the collection which will be updated below:
This is how to update a collection based on the Power Apps gallery checkbox control.
Also Read: How To Set Default Value in Power Apps List Box Control
Power Apps Select All checkbox in the gallery
Within the Power Apps gallery, we will see how to select the All checkbox. That is, when the user selects a specific checkbox control named All, it automatically selects all of the remaining checkbox items in the gallery. Similarly, unchecking that checkbox control unchecks all of the checkboxes.
If this is the requirement, then follow the below solutions:
- Suppose, we have a SharePoint list named Projects having a choice column called Skills.
- On the Power Apps, add a blank vertical gallery. Insert the below expression on the Gallery’s Items property to get all the choices from the Skills column.
Items = Choices(Projects.Skills)
Where Projects is the name of the SharePoint list and Skills is the name of the choice column. But it will display as blank shown below:
- Next, insert a check box control to the above blank vertical gallery and insert the below expression in the control’s Text property to show all the choices with the respective check box controls.
Text = ThisItem.Value
- Add another Power Apps check box control to the screen and place it just above the gallery (Outside of the gallery).
- Give a Text to the check box as “All”.
- Insert the below expression on the All checkbox’s OnCheck property.
OnCheck = Set(VarAllCheckbox, true)
Where VarAllCheckbox is the name of the global variable name.
- Similarly, insert the below expression in the All checkbox’s OnUncheck property.
OnUncheck = Set(VarAllCheckbox, false)
- Update the global variable name within the Default property of the Gallery’s checkbox control.
Default = VarAllCheckbox
Let’s preview the app and we can see when we check the All checkbox control, it will automatically check all the checkbox controls within the gallery.
This is how to create a master CheckBox to select all checkboxes within the Power Apps gallery.
Check Out: Power Apps Listbox items from SharePoint list
Power Apps gallery checkbox multiple selections
This section will look at how to use the Power Apps’ multiple selection checkbox control. That is, if the user selects multiple items from the Power Apps gallery, it will display all of those items. In addition, when the user removes items from the check box control, it displays all of the updated items.
To work with this requirement we will use the above Power Apps gallery and the following steps are:
- On that Power Apps gallery, select the checkbox control and insert the below expression on the checkbox’s OnCheck property.
OnCheck = Collect(CollSkills, ThisItem.Value)
Where CollSkills is the name of the collection.
- Insert the below expression on the checkbox control’s OnUncheck property.
OnUncheck = RemoveIf(CollSkills, Value = ThisItem.Value)
- Next, add a data table to display the multi-selected checkbox items. Select the data table and go to Fields > Edit fields > Add fields > Value.
- Then insert the below expression on the data table’s Items property.
Items = CollSkills.Value
Let’s preview the app and select multiple checkbox controls from the gallery.
Similarly, if we unchecked the checkbox controls, the data table will be updated like the below:
This is how to select Multiple checkbox controls in a Power Apps Gallery.
Have a look: How to use Power Apps List box control?
Power Apps reset checkbox in the gallery
In this section, we’ll look at how to reset the checkbox control(s) in the Power Apps gallery. That means the Power Apps gallery contains a reset icon or button. When the button or icon is clicked, all of the selected checkbox controls are reset, allowing the user to select the options as needed.
To work with this requirement, we will use the above example of the Power Apps gallery. The following steps are:
- Add a Reload icon to the Power Apps screen and place it in the top corner of the gallery.
- Insert the below expression on the Reload icon’s OnSelect property.
OnSelect = UpdateContext({VarChecked:true});UpdateContext({VarChecked:false});
Where VarChecked is the name of the UpdateContext variable name (local variable).
- Select the gallery’s checkbox control and set the update context variable name within the Reset property of the checkbox control.
Reset = VarChecked
That’s all! Let’s preview the app and check some items from the Gallery’s Power Apps Checkboxes. As we can see, clicking the Reload icon resets the checkbox controls within the gallery.
This is how to reset the Power Apps Checkboxes in the Gallery.
Read: Power Apps combo box default value
Power Apps set checkbox value in the gallery
In this section, we’ll look at how to set the checkbox values in the Power Apps gallery. That is, when the user selects a value from the dropdown list, the gallery’s checkbox will be checked accordingly.
- On the Power Apps screen, build a dropdown control to retrieve the choices from the Department column.
- Add a vertical gallery to display the workers’ Names.
- Add a checkbox control to the Power Apps gallery. Insert the below expression in the checkbox control’s Text property.
Text = ThisItem.Department.Value
Now the checkbox has the values as Finance, HR, and IT like below:
- Next, insert the below expression into the checkbox control’s Default property to check the controls automatically as per the dropdown selection.
Default = Department_dd.Selected.Value in ThisItem.Department.Value
Where Department_dd is the name of the dropdown control.
Now preview the app. Select an item from the dropdown control(ex: IT). We can see the person who belongs to that selected department, the respective checkbox will be checked like below:
This is how to set the value of a Checkbox Within a Power Apps Gallery.
Also Check: Power Apps Combo box with SharePoint list
Power Apps Gallery Checkbox disable
Here, we will see how to disable a checkbox control within the Power Apps gallery. That means when the user selects a check box control within the gallery, another check box will be disabled.
To work with this scenario, the following steps are:
- We have prepared a vertical gallery to display the user’s name.
- Inside that gallery, add 2 check box controls to that Power Apps gallery and rename them as “Active”, and “Not Active”.
- Select the Active checkbox control and insert the below expression on the DisplayMode property.
DisplayMode = If(NotActive_Checkbox.Value, DisplayMode.Disabled, DisplayMode.Edit)
Where NotActive_Checkbox is the name of the ‘Not Active’ check box control name.
- Similarly, insert the below expression on the ‘Not Active’ checkbox’s DisplayMode property.
DisplayMode = If(Active_Checkbox.Value, DisplayMode.Disabled, DisplayMode.Edit)
Where Active_Checkbox is the name of the ‘Active’ Checkbox control name.
Let’s preview the app and we can see when selecting any check box control, then another one will be disabled like the below:
This is how to disable a check box if the other check box is checked in the Power Apps gallery.
Read: Power Apps combo box filter
Power Apps Gallery Checkbox count
In this section, we’ll look at how to count the checkbox control in the Power Apps gallery. That is when a user checks any Power Apps checkbox control (s) in the Power Apps gallery, the total count of the checked checkbox control is displayed.
Suppose, we have a specific SharePoint list named Projects having a choice column named Skills. To work with the above requirement, the following steps are:
- On the Power Apps screen, add a Blank vertical gallery. Insert the below expression on the Items property f the gallery.
Items = Choices(Projects.Skills)
- Then add a checkbox control to the blank vertical gallery. Insert the below expression on the checkbox’s Text property. As a result, the checkbox has choices from the ‘Skills‘ choice column.
Text = ThisItem.Value
- To count the selected checkbox control within the gallery, add a Text Label control to the Power Apps screen and place the control outside of the gallery. Insert the below expression on the Label’s Text property.
Text = CountRows(Filter(Skills_Gallery.AllItems, Skills_Chckbx.Value))
Let’s check out the app. When we select the checkbox control(s) from the Power Apps gallery, the label control displays the total count of the checked checkbox controls.
This is how to count the number of checked items within a Power Apps gallery.
Check: How to Patch Power Apps Combo Box
Power Apps Gallery Checkbox single select
In this section, we will discuss how to work with the Power Apps Gallery Checkbox, which will be set to single select. That is, it will allow the user to select a single option from the Power Apps gallery control’s checkboxes.
To work with this requirement, we will use the above “Workers” SharePoint list and the following steps are:
- On the Power Apps screen, add a vertical gallery and keep the layout as Title to display the name of the workers.
- Next, add another blank vertical gallery within the above gallery. Insert the below expression on the Items property of the blank vertical gallery.
Items = Choices(Workers.Department)
- Inside that blank gallery, add a checkbox control and set the below formula in the checkbox’s Text property to display the choices in the respective checkbox controls.
Text = ThisItem.Value
- Add a label control to the inside gallery that displays the departments. Make sure to keep it in front of the checkbox control. Insert the below expression on the label’s visible property.
Visible = !ThisItem.IsSelected || !Department_Checkbox.Value
Where Department_Checkbox is the name of the checkbox control.
- Keep the label’s text color and the gallery’s background color the same. Let’s preview the app. we can see, it will allow us to select any one checkbox control at a time within the Power Apps gallery.
This is how to set the check box control for a single selection within the Power Apps gallery.
Read: How to Sort Combo Box Items in Power Apps
Power Apps Gallery Checkbox disable based on time value
Here, we will see how to disable the Powe Apps gallery checkbox controls based on the time value.
That is, if the checkbox value is less than the current time, the checkbox will be disabled within a Power Apps gallery. As a result, the user will only be able to select a future time like the below:
We can see, it will disable the check box controls whose time value is less than the current time value. To work with this scenario, the following steps are:
- We have prepared a SharePoint list named Interviews having a choice column as well as the choices like below:
- On the Power Apps screen, add a vertical gallery and connect the gallery with the desired SharePoint list i.e., Interviews to display the other details of the list such as Title, and Interviewer’s name.
- Inside the above vertical gallery, add another blank gallery and insert the below expression on the gallery’s Items property.
Items = Choices(Interviews.'Time Slots')
- But the gallery will display as blank. Add a checkbox control to that blank gallery and insert the below expression on the checkbox’s Text property.
Text = ThisItem.Value
Now the blank gallery’s check box has its own values that retrieve from SharePoint’s Time Slot column.
- To disable the checkbox based on the time value, insert the below expression on the checkbox’s DisplayMode property.
DisplayMode = If(TimeValue(Now()) > TimeValue(ThisItem.Value), DisplayMode.Disabled,Edit)
We can see it will disable the past time and let the user select time slots from the future time.
To get the current time, add a label control to the screen and place it above the gallery control. Insert the below expression on the label’s Text property.
Text = "The current Time: " & Now()
As the current time is ‘7:09 PM‘, so it disables all the past time values i.e., 8:30 AM, and 11:30 AM.
This is how to disable the checkbox controls within the Power Apps gallery based on the time value.
Power Apps checkbox filter gallery
Would you like to filter the gallery based on checkbox selection whether it is a single selection or multiple selections?
Recently, we published an article where we described how to filter a Power Apps gallery based on multiple checkbox controls. We recommend you follow the mentioned link to get the answer.
Furthermore, have a look at the below more tutorials:
- How to Patch Power Apps Date Picker
- [Solved]Can’t convert this data type. Power Apps can’t convert this Date to a Boolean
- How to Reset Power Apps Date Picker
- Power Apps combo box with Office 365 users
- How to Reset Power Apps Combo Box
- How to use Power Apps Combo Box Control?
- Power Apps Cascading Dropdown Control
- How to Filter Power Apps Dropdown Control
Conclusion
From this Power Apps Tutorial, we learned how to work with checkbox control within a Power Apps gallery based on different types of situations such as:
- Power Apps checkbox add from gallery to collection
- Power Apps Select All checkbox in the gallery
- Power Apps gallery checkbox multiple selections
- Power Apps reset checkbox in the gallery
- Power Apps set checkbox value in the gallery
- Power Apps Gallery Checkbox disable
- Power Apps Gallery Checkbox count
- Power Apps Gallery Checkbox single select
- Power Apps Gallery Checkbox disable based on time
- Power Apps checkbox filter gallery
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.
We need information about how to remove items from collection when checkbox is unchecked after using Select All checkbox outside of gallery.