Introduction
This blog with the video walks you through how you can update filtered items in bulk. In this blog items bulk updates have been done in an Excel spreadsheet present in OneDrive, however, you can do the same for SharePoint lists or SQL tables.
Scenario
Consider an IT asset inventory as shown below. You'd like to filter this inventory by either manufacturer (MFR) or device or name or accessory and update the quantity in bulk. For example, we'd like to update all the Inspiron 17 quantity to 10.
Below is a screenshot of the screen. The top row which is a group of 7 labels to give it a table look and feel. On the right are 4 drop down controls where you can choose any of the options you'd like to filter the gallery with. In This example only one choice selection can be made at a time. Selecting two simultaneously will give an empty response.
The filtering is done using the FILTER formula in the ITEMS. In addition, the filtering only occurs if something other than the "Select one" option is selected in the dropdown .
The submit button's OnSelect function with a combination of the 'Update in bulk' checkbox has the formula which will both filter and update the quantity column of the filtered items. Take a look at the formula below.
Closer look at the formula
Filter function in ITEMS
The formula is a combination of FILTER with the IF function where the IF runs inside the FILTER. In addition we are using the 'not equal to' or '<>' comparison in combination with the 'or' or ||
Here is an overview of the syntax we are following
FILTER(DataSource, If(SelectedValue1<>"Select one"||SelectedValue2<>"Select one"||SelectedValue3<>"Select one"||SelectedValue4<>"Select one")
Here is what the formula looks with the columns names
Filter(Inventory,If(MFRDropdown1.Selected.Value<>"Select one",MFR=MFRDropdown1.Selected.Value)||
If(DeviceDropdown1.Selected.Value<>"Select one",Device=DeviceDropdown1.Selected.Value)||
If(NameDropdown1.Selected.Value<>"Select one",Name=NameDropdown1.Selected.Value)||
If(AccDropdown1.Selected.Value<>"Select one",Accessory=AccDropdown1.Selected.Value))
Submit button's on select
The formula is combination of UPDATEIF with IF where the UPDATEIF runs inside the IF. We are also using the '||' or double colon to create the OR function.
Here is an overview of the syntax we are following
If( Condition, UpdateIf( DataSource, Condition1||Condition2||Condition3||Condition4, ChangeRecords ) )
Here is what the formula looks with the columns names
If(Checkbox1.Value=true,UpdateIf(Inventory,MFR=MFRDropdown1.Selected.Value||Device=DeviceDropdown1.Selected.Value||Name=NameDropdown1.Selected.Value||Accessory=AccDropdown1.Selected.Value,{Quantity:TextInput2.Text}))
Video
This video walks you through how the PowerApps works and walks you through the formula
Conclusion
This blog is attached with a zipped file that contains both the Excel spreadsheet and the Power's MSAPP file which you can use to re-create this exact scenario and with a little bit of reverse engineering learn on how to do bulk updates with filtered items in PowerApps.
Reference links