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 delete SharePoint list item, related items, and confirmation

  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 RemoveIf - Delete Records in a SharePoint list IF Title equals

    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: delete SharePoint item in Power Apps + confirmation popup - Tutorial for begginers

  12. Close the app preview.

FAQs

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 you clean Power Apps collections? ›

The Clear function deletes all the records of a collection. The columns of the collection will remain. Note that Clear only operates on collections and not other data sources. You can use RemoveIf( DataSource, true ) for this purpose.

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.

How do I remove duplicates from a collection power app? ›

PowerApps Remove Duplicate in a Collection
  1. Get Distinct (Collection Name is colSample) ClearCollect( colDistinct, Distinct( colSample, CreatedDate. ) ); Output for the above command.
  2. Clear the collection before collect. Clear(colFinal);
  3. Loop through the Distinct collection and get the first item from the main collection.
Aug 7, 2021

How do I clear the power app cache? ›

Steps to Clear Cache while Working with Power Apps Portals
  1. Sign in to the Dynamics 365 portal as an administrator. [Portal User With Administrator role inD365] ...
  2. Navigate to the URL as follows: /_services/about.
  3. After this, the portal details page will be open. Click on the Clear Cache button to clear the cache.
Jun 15, 2021

What is the difference between collect and ClearCollect in Power Apps? ›

With a single function, ClearCollect offers the combination of Clear and then Collect. ClearCollect returns the modified collection as a table. ClearCollect can only be used in a behavior formula. I hope this helps you!

How do I manually delete apps and features? ›

  1. Select Start , then select Settings > Apps > Apps & features.
  2. Select the app you want to remove, and then select Uninstall.

What is another button for Delete? ›

The ALT + BACKSPACE keyboard shortcut replaces the DELETE key and now that I know about it, I use it quite often. ALT + BACKSPACE, as I mentioned, is DELETE—that is, delete the NEXT letter after the cursor.

How do I delete unwanted app data? ›

Delete unused apps and free up space
  1. On your Android device, open Files by Google .
  2. At the bottom left, tap Clean .
  3. If you don't find "Delete unused apps" card, scroll to "Free up more space" card and tap Search for apps.
  4. On the confirmation dialog, tap Continue.
  5. On the “Usage access” screen, tap Files by Google.

How do I uninstall unwanted objects app? ›

Simply upload your image, find the object removal tool, resize the brush, and paint over your unwanted objects. Then, leave the rest to Fotor, which will remove the object in seconds and blend the photo nicely to make it look more natural. Try it out!

How do I delete multiple records in Power Apps? ›

Insert the button or the Trash icon and on the icon add “OnSelect” - Remove(test123,Gallery1_1. Selected). Your items will be deleted.

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

empty() will empty the selection of its contents, but preserve the selection itself. remove() will empty the selection of its contents and remove the selection itself.

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 is the major difference between pop () and remove ()? ›

Array elements can be removed using pop() or remove() method. The difference between these two functions is that the former returns the deleted value whereas the latter does not. The pop() function takes either no parameter or the index value as its parameter.

Which function is used to remove an Object? ›

The delete operator removes a property from an object.

Can we use remove function in string? ›

Remove(Int32, Int32)

Returns a new string in which a specified number of characters in the current instance beginning at a specified position have been deleted.

What is the syntax of remove () a file? ›

remove() Following is the syntax of remove() function. If the file is present, remove() function deletes the file. But, if the file is not present, remove() function throws FileNotFoundError.

How do you use distinct function in Power Apps? ›

Example
  1. Insert a Button control, and set its OnSelect property to this formula. ...
  2. Select the button while holding down the Alt key. ...
  3. Insert a Data table control, and set its Items property to this formula: ...
  4. Use the Edit fields link in the data table's properties pane to add the Result column:
Dec 15, 2022

How do I get distinct values in Power Apps? ›

Distinct – unique values in Power Apps
  1. Insert a ComboBox control. As items you can simply use a column, but then these items are seen duplicated:
  2. So let´s use the Distinct to wrap the column.
  3. now you only see the list of unique values:
  4. Leave a Reply. Your email address will not be published. Δ

How do I filter and remove duplicates? ›

To filter for unique values, click Data > Sort & Filter > Advanced. To remove duplicate values, click Data > Data Tools > Remove Duplicates. To highlight unique or duplicate values, use the Conditional Formatting command in the Style group on the Home tab.

Does clearing app cache delete everything? ›

Tip: Clearing the cache simply clears temporary files. It won't erase login credentials, downloaded files, or custom settings.

Does clearing app cache delete data? ›

Clear the app cache files of any app you think is causing performance issues, or delete app data for any apps you want to open with a clean slate. You'll get some storage space back, but nothing you've downloaded will be deleted. Depending on the app, user data such as your preferences or search history may be reset.

What are the two types of PowerApps? ›

There are two main types of Power Apps: Canvas apps and Model-driven apps. Previously, Power Apps Portals would have fallen under this category. Microsoft have since released Power Pages, a standalone product that has evolved from the functionality of Power Apps Portals.

How many collections can you have in PowerApps? ›

Power Apps collections are limited to a size of 2,000 records unless you know the special techniques needed to go past that number. This is because the ClearCollect and Collect functions can only return as many records as the delegation limit allows.

Can we refresh collection in PowerApps? ›

If you only want to "refresh" the collection, you can add a button, copy the original formula that create that collection and paste OnSelect of the button. In Power Apps Canvas apps, refreshing a collection means to create the collection again.

What is difference between remove () and empty ()? ›

The empty() method removes all child nodes and content from the selected elements. Note: This method does not remove the element itself, or its attributes. Tip: To remove the elements without removing data and events, use the detach() method. Tip: To remove the elements and its data and events, use the remove() method.

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 use of remove () in ArrayList? ›

The remove() method removes the single element from the arraylist.

Which command is used to remove an empty? ›

Use the rmdir command to remove the directory, specified by the Directory parameter, from the system. The directory must be empty (it can contain only . and ..) before you can remove it, and you must have write permission in its parent directory.

Which command can be used to remove a non empty? ›

To remove a directory that is not empty, use the rm command with the -r option for recursive deletion.

What are the two methods for removing items from a list? ›

The methods are remove(), pop() and clear(). It helps to remove the very first given element matching from the list. The pop() method removes an element from the list based on the index given. The clear() method will remove all the elements present in the list.

What is the difference between the Remove object obj and remove int index methods? ›

The remove(int index) method accepts the index of the object to be removed, and the remove(Object obj) method accepts the object to be removed.

How to remove items from a list Java? ›

There are two remove() methods to remove elements from the List.
  1. E remove(int index ) : This method removes the element at the specified index and returns it. The subsequent elements are shifted to the left by one place. ...
  2. boolean remove(Object o ) This method removes the first occurrence of the specified Object .
Aug 3, 2022

How to remove an object from list in Java based on condition? ›

To remove elements from ArrayList based on a condition or predicate or filter, use removeIf() method. You can call removeIf() method on the ArrayList, with the predicate (filter) passed as argument. All the elements that satisfy the filter (predicate) will be removed from the ArrayList.

How to remove list of objects from another list in Java? ›

There are two ways to remove objects from ArrayList in Java, first, by using the remove() method, and second by using Iterator. ArrayList provides overloaded remove() method, one accepts the index of the object to be removed i.e. remove(int index), and the other accept objects to be removed, i.e. remove(Object obj).

Videos

1. Power Apps Functions Tutorial. Part 1
(Power Platform: From Zero to Hero)
2. Função RemoveIf - PowerApps
(Eduardo Amaral - Power Apps - Power Automate)
3. ClearCollect, Clear, and Remove - Collections in Microsoft PowerApps
(Cloudatica)
4. 👉7 Beginner Power Apps Functions You Must Learn First 💡 [Episode 39]
(Pragmatic Works)
5. Power Apps: Pop-Up Screens For Deleting Records [Power Platform Series - Ep. 10]
(Pragmatic Works)
6. Power Apps: Use Patch To Update and Soft Delete Records [Power Platform Series - Ep. 14]
(Pragmatic Works)
Top Articles
Latest Posts
Article information

Author: Francesca Jacobs Ret

Last Updated: 02/07/2023

Views: 6553

Rating: 4.8 / 5 (68 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Francesca Jacobs Ret

Birthday: 1996-12-09

Address: Apt. 141 1406 Mitch Summit, New Teganshire, UT 82655-0699

Phone: +2296092334654

Job: Technology Architect

Hobby: Snowboarding, Scouting, Foreign language learning, Dowsing, Baton twirling, Sculpting, Cabaret

Introduction: My name is Francesca Jacobs Ret, I am a innocent, super, beautiful, charming, lucky, gentle, clever person who loves writing and wants to share my knowledge and understanding with you.