Remove and RemoveIf functions in Power Apps - Power Platform (2023)

  • Article
  • 6 minutes to read

Removes records from a data source.

Description

Remove function

Use the Remove function to remove a specific record or records from a data source.

For collections, the entire record must match. You can use the All argument to remove all copies of a record; otherwise, only one copy of the record is removed.

RemoveIf function

Use the RemoveIf function to remove a record or records based on a condition or a set of conditions. Each condition can be any formula that results in a true or false and can reference columns of the data source by name. Each condition is evaluated individually for each record, and the record is removed if all conditions evaluate to true.

Remove and RemoveIf return the modified data source as a table. You can use both functions only in behavior formulas.

You can also use the Clear function to remove all of the records in a collection.

Delegation

When used with a data source, these functions can't be delegated. Only the first portion of the data source will be retrieved and then the function applied. The result may not represent the complete story. A warning may appear at authoring time to remind you of this limitation and to suggest switching to delegable alternatives where possible. For more information, see the delegation overview.

Syntax

Remove( DataSource, Record1 [, Record2, ... ] [, All ] )

  • DataSource – Required. The data source that contains the record or records that you want to remove.
  • Record(s) – Required. The record or records to remove.
  • All – Optional. In a collection, the same record may appear more than once. You can add the All argument to remove all copies of the record.

Remove( DataSource, Table [, All ] )

  • DataSource – Required. The data source that contains the records that you want to remove.
  • Table – Required. A table of records to remove.
  • All – Optional. In a collection, the same record may appear more than once. You can add the All argument to remove all copies of the record.

RemoveIf( DataSource, Condition [, ... ] )

  • DataSource – Required. The data source that contains the record or records that you want to remove.
  • Condition(s) – Required. A formula that evaluates to true for the record or records to remove. You can use column names from the DataSource in the formula. If you specify multiple Conditions, all must evaluate to true for the record or records to be removed.

Examples - single formulas

In these examples, you'll remove a record or records in a data source that's named IceCream and that starts with the data in this table:

Remove and RemoveIf functions in Power Apps - Power Platform (1)

Create a collection with sample records

To create a collection with this data:

  1. Insert a Button control.

  2. Set button control's OnSelect property to the below formula:

    ClearCollect( IceCream, { ID: 1, Flavor: "Chocolate", Quantity: 100 }, { ID: 2, Flavor: "Vanilla", Quantity: 200 }, { ID: 3, Flavor: "Strawberry", Quantity: 300 })
  3. Select the button while holding down the Alt key:

    (Video) Remove Vs RemoveIF functions in Power Apps

Remove sample records from collection using a formula

FormulaDescriptionResult
Remove(IceCream,
LookUp(IceCream,Flavor="Chocolate"))
Removes the Chocolate record from the data source.Remove and RemoveIf functions in Power Apps - Power Platform (2)

The IceCream data source has been modified.

Remove(IceCream,
LookUp(IceCream,Flavor="Chocolate"), LookUp(IceCream,Flavor="Strawberry") )
Removes two records from the data source.Remove and RemoveIf functions in Power Apps - Power Platform (3)

The IceCream data source has been modified.

RemoveIf(IceCream, Quantity>150 )Removes records that have a Quantity that's greater than 150.Remove and RemoveIf functions in Power Apps - Power Platform (4)

The IceCream data source has been modified.

RemoveIf(IceCream, Quantity>150, Left(Flavor,1) = "S" )Removes records that have a Quantity that's greater than 150 and Flavor starts with an S.Remove and RemoveIf functions in Power Apps - Power Platform (5)

The IceCream data source has been modified.

RemoveIf(IceCream, true )Removes all records from the data source.Remove and RemoveIf functions in Power Apps - Power Platform (6)

The IceCream data source has been modified.

Examples - remove button outside a gallery

In this example, you'll use a Gallery control to list the records in a table. And then use the Remove function to selectively remove an item.

Prepare for sample data

This example uses the Contacts table in Microsoft Dataverse available with the sample apps and data. You can deploy sample apps and data when you create an environment. You can also use any other data source instead.

Remove button outside a gallery

In this example, you'll remove an item by using a button that is outside the gallery.

  1. Create a new blank canvas app using a Phone layout.

    Remove and RemoveIf functions in Power Apps - Power Platform (7)

  2. Select the Insert from the left pane.

  3. Select Vertical gallery.
    A Gallery control is be added to your screen.

    Remove and RemoveIf functions in Power Apps - Power Platform (8)

  4. You're prompted to select a data source where you can select a data source from the available data sources.
    For example, select the Contacts table to use sample data:

    Remove and RemoveIf functions in Power Apps - Power Platform (9)

    The gallery shows items from this table:

    Remove and RemoveIf functions in Power Apps - Power Platform (10)

  5. Insert a Button control from left pane:

    Remove and RemoveIf functions in Power Apps - Power Platform (11)

  6. Move the added button below the gallery items:

    Remove and RemoveIf functions in Power Apps - Power Platform (12)

  7. Update button text property to Remove record. You can also use text of your choice:

    Remove and RemoveIf functions in Power Apps - Power Platform (13)

    (Video) PowerApps RemoveIf - Delete Records in a SharePoint list IF Title equals

  8. Set the OnSelect property for this button control to the following formula:

    Remove( Contacts, Gallery1.Selected )

    Remove and RemoveIf functions in Power Apps - Power Platform (14)

    The gallery control makes the currently selected record available using Selected property. Remove function refers to this selected record to remove it.

  9. Preview the app using the Play button on the top right, or press F5 on keyboard:

    Remove and RemoveIf functions in Power Apps - Power Platform (15)

  10. Select a record to remove, such as Nancy's record in this example:

    Remove and RemoveIf functions in Power Apps - Power Platform (16)

  11. Select Remove record:

    Remove and RemoveIf functions in Power Apps - Power Platform (17)

    Selecting the button removes the selected record (in this example, Nancy's record).

  12. Close the app preview.

    Tip

    You can also use alternate behavior with Alt key instead of using the app preview with Play button or F5.

Examples - trash can icon inside a gallery

In this example, you'll remove an item by using an icon placed inside the gallery.

Create a collection with sample data

If you already have prepared sample data, skip this step and move to Trash can icon inside a gallery.

  1. Add a Button control to your screen.

  2. Set the OnSelect property to the following formula:

    (Video) PowerApps delete SharePoint list item, related items, and confirmation

    ClearCollect( SampleContacts, { 'Full Name': "Yvonne McKay (sample)", 'Primary Email': "someone_a@example.com" }, { 'Full Name': "Susanna Stubberod (sample)", 'Primary Email': "someone_b@example.com" }, { 'Full Name': "Nancy Anderson (sample)", 'Primary Email': "someone_c@example.com" }, { 'Full Name': "Maria Campbell (sample)", 'Primary Email': "someone_d@example.com" }, { 'Full Name': "Robert Lyon (sample)", 'Primary Email': "someone_e@example.com" }, { 'Full Name': "Paul Cannon (sample)", 'Primary Email': "someone_f@example.com" }, { 'Full Name': "Rene Valdes (sample)", 'Primary Email': "someone_g@example.com" })
  3. Select the button while holding down the Alt key.

Sample collection is created that you can use in the following example.

Trash can icon inside a gallery

  1. Create a new blank canvas app using a Phone layout.

    Remove and RemoveIf functions in Power Apps - Power Platform (18)

  2. Select the Insert from the left pane.

  3. Select Vertical gallery.
    A Gallery control is be added to your screen.

    Remove and RemoveIf functions in Power Apps - Power Platform (19)

  4. You're prompted to select a data source where you can select a data source from the available data sources.
    For example, select the Contacts table to use sample data:

    Remove and RemoveIf functions in Power Apps - Power Platform (20)

    If you created a collection, select your collection instead:

    Remove and RemoveIf functions in Power Apps - Power Platform (21)

  5. Select a control within the top item in the gallery.

    To ensure next step inserts item into gallery's template and not outside the gallery, ensure you follow this step before moving to the next step.

    Remove and RemoveIf functions in Power Apps - Power Platform (22)

  6. Select Add icon from left pane.

    Remove and RemoveIf functions in Power Apps - Power Platform (23)

    Note

    (Video) PowerApps RemoveIf - Delete ALL Records in a SharePoint list from PowerApps button click

    Add icon inserts a + icon on the left side of the gallery, replicated for each item in the gallery.

  7. In the top item, move the icon to the right side of the screen.

    Remove and RemoveIf functions in Power Apps - Power Platform (24)

  8. Select the Icon property for icon and set it to the following formula to update the icon image as trash icon:

    Icon.Trash

    Note

    The Icon. prefix is only shown when you're actively editing the formula.

    Remove and RemoveIf functions in Power Apps - Power Platform (25)

  9. Set the OnSelect property to the following formula:

    Remove( [@Contacts], ThisItem )

    Note

    You must use global disambiguation operator [@...] in this example with sample data that uses the Contacts table to avoid conflict with a One-to-Many relationship. If you use data sources such as a list or a SQL Server table, using global disambgulation operator is not required.

    Remove and RemoveIf functions in Power Apps - Power Platform (26)

  10. Preview the app using the Play button on the top right, or press F5 on keyboard.

  11. Select the trash icon next to a record, for example Maria's:

    Remove and RemoveIf functions in Power Apps - Power Platform (27)

    The record is deleted:

    Remove and RemoveIf functions in Power Apps - Power Platform (28)

    (Video) Power Apps Functions Tutorial. Part 1

  12. Close the app preview.

FAQs

What is the difference between remove and RemoveIf in Power Apps? ›

We will compare Remove Vs RemoveIf with syntax and functionality. Remove Power Fx function in Power Apps basically used to remove or delete the specific record. RemoveIf function can remove or delete the records conditionally!

How do I remove data from a table in Power Apps? ›

Sign into Power Apps, select Solutions in the left navigation pane, open the solution that contains the custom table you want to delete, and then select it. On the command bar select Remove, and then select from the following choices: Remove from this solution. Removes the table from the solution.

How do I remove items from a collection in Powerapp? ›

Now to remove an item from the Powerapps Collection, click on any trash icon of an item. Then that item will be removed from the Gallery as well as Powerapps Collections. Similarly, To remove all the items from the Powerapps collections, click on the Clear Item button.

What is the difference between ClearCollect and collect? ›

The ClearCollect function deletes all the records from a collection. And then adds a different set of records to the same collection. With a single function, ClearCollect offers the combination of Clear and then Collect. ClearCollect returns the modified collection as a table.

What is the difference between the remove () function and the RemoveIf () function? ›

Remove Function – Use the Remove function to remove & delete a specific record or records from a data source in Microsoft Power Apps. RemoveIf Function- Use the RemoveIf function to remove & delete a record or records based on a condition or a set of conditions in Microsoft Power Apps.

How do I use RemoveIf in Power Apps? ›

Description
  1. Use the Remove function to remove a specific record or records from a data source.
  2. For collections, the entire record must match. ...
  3. Use the RemoveIf function to remove a record or records based on a condition or a set of conditions. ...
  4. Remove and RemoveIf return the modified data source as a table.
Jan 9, 2023

How can I remove data but keep the table? ›

Tip. To remove a table but keep data and formatting, go to the Design tab Tools group, and click Convert to Range. Or, right-click anywhere within the table, and select Table > Convert to Range.

How do I clean up data in Power Query? ›

Launch Power Query from Excel. Navigate the user interface (UI) of Power Query. Connect to disparate data sources by using Power Query. Use Power Query to clean and transform data for a data model.

How do I remove a specific item from a collection? ›

remove() method is used to remove elements from a collection. It removes the element at the specified position in this list. Shifts any subsequent elements to the left by subtracts one from their indices.

How do I remove one element from a collection? ›

An element can be removed from a Collection using the Iterator method remove(). This method removes the current element in the Collection. If the remove() method is not preceded by the next() method, then the exception IllegalStateException is thrown.

Which method removes all items from a collection? ›

Explanation: clear() method removes all the elements from invoking collection.

How does PowerApps handle mass deletes from a data source? ›

How does PowerApps handle mass deletes from a data source? A)PowerApps has a built-in recycle bin.

How do I filter a collection in PowerApps? ›

In the Gallery Screen, You can see all records (Name and ID) that belong to Bangalore. This is how to use a filter in PowerApps Collection.
...
  1. Filter = Function Name.
  2. CandidateInfo = Collection Name.
  3. Address = Field Name.
  4. Bangalore = Filter Value.
Jun 10, 2021

How do I patch a collection in PowerApps? ›

  1. Create A New Record With Power Apps Patch Function. ...
  2. Update An Existing Record Using Power Apps Patch Function. ...
  3. Get The Result Of The Patch Function. ...
  4. Create Multiple New Records With Power Apps Patch Function. ...
  5. Edit Multiple Existing Records Using Power Apps Patch Function.
Jun 12, 2022

What does the remove () method do? ›

The remove() method takes a single element as an argument and removes it from the list. If the element doesn't exist, it throws ValueError: list.remove(x): x not in list exception.

What is the functionality of the remove () method? ›

The remove() method removes the first occurrence of the element with the specified value.

What is the use of remove () function? ›

Use the REMOVE function to successively extract and return dynamic array elements that are separated by system delimiters, and to indicate which system delimiter was found. When a system delimiter is encountered, the value of the extracted element is returned.

How do I delete a custom form in Power Apps? ›

Delete the custom form

Under General settings, select Form settings. On the Form Settings page, select Use the default SharePoint form, and then select Delete custom form.

How do you add a blank value to a dropdown list in Power Apps? ›

Power Apps makers can design a dropdown that starts with a blank value by setting the AllowEmptySelection property to true.

Why can't i delete a model driven app in Power Apps? ›

It is not possible to delete a model-driven app or site map that was installed in the environment as part of a managed solution. Instead, the managed solution must be deleted.

What is removeIf? ›

The removeIf() method of ArrayList is used to remove all of the elements of this ArrayList that satisfies a given predicate filter which is passed as a parameter to the method. Errors or runtime exceptions are thrown during iteration or by the predicate are pass to the caller.

What is the difference between removeIf and removeAll Java? ›

Looking at the code, removeIf has a custom implementation for CopyOnWriteArrayList , but removeAll iterates over the indices and will end up throwing ArrayIndexOutOfBoundsException or even worse, removing the wrong element, if called concurrently.

What is the difference between remove and pop function of list? ›

The remove() function removes the first matching value from the list. The pop() function is used to return the removed element from the list.

What is difference between uninstall and remove? ›

Yes, on Android devices “uninstall” is the same thing as “delete". When you remove an app you purchased, you can still reinstall it without having to pay again. However, deleting apps on Android won't always delete all of the app's files and associated data.

How does removeIf work in Java? ›

removeIf will go through each element in your list and run the specified predicate (boolean function) on it. If the predicate returns true , it will be removed from the list. If the predicate returns false , it will not. In your case, every element will result in the predicate returning true , thus clearing the list.

What is equivalent to removeIf in Java? ›

removeIf(hashSetB::remove); Is equivalent to: hashSetA.

What is the opposite of removeIf Java? ›

Note that the filter() function has the opposite boolean logic as removeIf(): true means keep the element, false means remove it.

How do I remove all elements from an ArrayList? ›

The Java ArrayList removeAll() method removes all the elements from the arraylist that are also present in the specified collection. The syntax of the removeAll() method is: arraylist. removeAll(Collection c);

How do I remove all elements from a collection? ›

The removeAll() method of java. util. ArrayList class is used to remove from this list all of its elements that are contained in the specified collection. Parameters: This method takes collection c as a parameter containing elements to be removed from this list.

What is removeAll method? ›

The removeAll() method in java is used to remove the occurrence of all the elements in the ArrayList that are present in the specified collection. It belongs to the java. util. ArrayList class.

What is the difference between pop () and Popitem ()? ›

Although we use pop() and popitem() to remove elements from a dictionary, they are actually different. pop() can remove any item from a dictionary as long as you specify the key. On the other hand, popitem() can only remove and return the value of the last element in the dictionary.

What is the difference between remove () and empty () methods *? ›

remove() – Removes all child elements with selected element. In this method you can restore all data but not event handlers of removed elements from the DOM. All data and events related with elements will be removed. empty() – Removes all content and child elements from the selected element.

What are the two ways to remove something to a list? ›

There are three ways in which you can Remove elements from List:
  1. Using the remove() method.
  2. Using the list object's pop() method.
  3. Using the del operator.
Jan 3, 2023

Why do we need to uninstall or remove programs? ›

Uninstalling unused or unwanted programs can help your computer in various ways. By uninstalling these programs you will be, Adding hard drive space. Increasing computer speed – By removing programs you're not using, they won't have access to run in your background; therefore, increasing PC speeds.

Why disable instead of uninstall? ›

Uninstalling an app will remove it entirely from your phone. Disabling an app will remove it from the apps screen and stop it from running in the background.

What is the difference between remove and replace and remove and install? ›

R&R is a replacement for an entirely new piece for the car. What Is R&I? Unlike R&R, where a part is entirely replaced, R&I stands for “remove and install.” This happens when a part is removed from the damaged car and reinstalled later.

Videos

1. Power Apps: Use Patch To Update and Soft Delete Records [Power Platform Series - Ep. 14]
(Pragmatic Works)
2. Função RemoveIf - PowerApps
(Eduardo Amaral - Power Apps - Power Automate)
3. Power Apps: delete SharePoint item in Power Apps + confirmation popup - Tutorial for begginers
(Power Rudy)
4. Power Apps: Pop-Up Screens For Deleting Records [Power Platform Series - Ep. 10]
(Pragmatic Works)
5. Power Apps: Safeguard Deleting Records
(Pragmatic Works)
6. Patch Function in Power Apps
(Dhruvin Shah)
Top Articles
Latest Posts
Article information

Author: Nathanial Hackett

Last Updated: 03/13/2023

Views: 6418

Rating: 4.1 / 5 (72 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Nathanial Hackett

Birthday: 1997-10-09

Address: Apt. 935 264 Abshire Canyon, South Nerissachester, NM 01800

Phone: +9752624861224

Job: Forward Technology Assistant

Hobby: Listening to music, Shopping, Vacation, Baton twirling, Flower arranging, Blacksmithing, Do it yourself

Introduction: My name is Nathanial Hackett, I am a lovely, curious, smiling, lively, thoughtful, courageous, lively person who loves writing and wants to share my knowledge and understanding with you.