Bulk Ops in Power Apps
Scenario:
User wants bulk operations like status change to multiple items in Power Apps. The data for this is saved in SharePoint online lists or Data verse.
So first thing first, let just design a simple app. Our app will have a gallery on the screen, this gallery will be linked to a SharePoint online list.
Then we will add checkbox field in the gallery and also put in few labels to show data values of the respective list.
Next we need to go to the OnCheck property of this checkbox control. Here what we will do is create a collection and add the selected item on it.
Code for this will look something like this Collect(collectionName, ThisItem)
Similarly, we will now proceed to the OnUncheck property code for it will look something like
Remove(collectionName,ThisItem).
So what we are trying to do in here is that on check of the checkbox we are adding the selected item from the gallery into your collection, named as collectionName in above code.
Next we add two button on the screen, in our case lets call them Approved & Rejected.
Now OnSelect property of the button we will write this code,
//This below line updates the column value to Approved
UpdateIf(collectionName,true,{Status:"Approved"}
//In this line we create another collection with all the columns that we wish to use while Patching
ClearCollect(collectionName2,ShowColumns(collectionName,"Status","ID","CongID","Milestone"));
// We Patch the above created collection directly to our SharePoint list.
Patch(SharePointList,collectionName2);
Now, to test the above solution, what we need to do is hit Play select multiple checkboxes and click the button and the Updateif and Patch will work their magic and BulksOps done.
Next we will try and work on Exporting the Gallery to a CSV using Power Automate.
Comments
Post a Comment