hey @Prathamesh2415
try the following approach please:
- Place a checkbox outside the gallery and name it chkSelectAll.
- Set its OnCheck property to:
ClearCollect(selectedColl, Filter(Datasource, UserEmail = User().Email and Status="Pending"))
Set its OnUncheck property to:
Clear(selectedColl)
In the gallery, your existing checkbox should have the OnCheck and OnUncheck properties set as you described.
OnCheck: If(!chkSelectAll.Value, Collect(selectedColl, ThisItem))
OnUncheck: If(!chkSelectAll.Value, RemoveIf(selectedColl, ID = ThisItem.ID))
For the button that approves the selected items, set its OnSelect property to something like:
ForAll(selectedColl As _item, Patch(Datasource, LookUp(Datasource, ID = _item.ID), {Status: "Approved"}))
Ensure that the gallery's Items property is set to filter based on the current status, like:
Filter(Datasource, UserEmail = User().Email and Status="Pending")
Let me know if my answer helped solving your issue.
If it did please accept as solution and give it a thumbs up so we can help others in the community.
Greetings