A Gallery control can show multiple records from a data source, and each record can contain multiple types of data
However, in many scenarios, users need to select multiple records within a gallery to perform actions like bulk updates or deletion.
This functionality can be achieved efficiently using checkboxes to allow multiple record selection.
Selecting mutliple records in a gallery
Select the Gallery and go to Insert tab and select the Check box control.

Now, set the Check box Text property to empty.

Now, you can see the App preview. Each records in gallery has a checkbox and you can select multiple records.

Save the checked items into collection
For this, select the Check box in a gallery and go to OnCheck property of Check box control and set to below formula.
Collect(colEmployeeInfo, ThisItem)
It creates a collection and store the current selected items in a gallery to Collection.
[Read about: Collection]

Remove the Items from collection when record is unchecked in a gallery
For this go to the Check box OnUncheck property and write the below formula.
RemoveIf( colEmployeeInfo, ID = ThisItem.ID )
This formula, will remove the uncheck items from collection.
Note that, ID is a primary key field.

Let’s verify whether the selected records are being saved to the collection.
Preview the app and select any records from the gallery. Here, we have selected two records from the gallery.

Now, Go to App and see the Collection.
Click on the … More tab, then select Variables under the Collections section. You will see that colEmployeeInfo has been created and contains two records.

Now, uncheck one record from the gallery, and you will notice that the unchecked record is removed from the collection, leaving only one record remaining.

Update the selected records
Let’s say you want to activate or deactivate the selected employees, which means updating the IsActive field values from “Yes” to “No” or vice versa for each selected employee record in the gallery.
As shown in the screenshot below, all employees are currently active, as indicated by the “Yes” value.

Add a dropdown control by navigating to Insert and selecting the Dropdown control.

Now, assign the values “Yes” and “No” to it’s Items property.
["Yes", "No"]

Now, add a TextInput control and name it “isActive”, and also add a Button control and name it “Update”.

The goal is to update the isActive value in the data source for all the selected records in the gallery based on the value the user selects from the isActive dropdown.
UpdateIf(
colEmployeeInfo,
true,
{isActive: drp_isActive.Selected.Value}
);
Patch(
'Employee Info',
colEmployeeInfo
)
[Read about UpdateIf function]
This will update the selected values from the dropdown for the isActive column in the colEmployeeInfo collection. After that, the PATCH function will patch a collection to a data source.

Also, clear a collection at the end.
Clear(colEmployeeInfo);

Let’s deactivate two employees, select the employees from the gallery using the checkboxes, choose “No” from the isActive dropdown, and then click the Update button.

You will see that the selected records have been deactivated, and their values are now showing as “No”.

Recommended for you..
![]()
