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 data source.

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 blue dot will 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

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:

Formula Description Result
Remove( IceCream,
First( Filter( IceCream, Flavor="Chocolate" ) ) )
Removes the Chocolate record from the data source.

The IceCream data source has been modified.
Remove( IceCream,
First( Filter( IceCream, Flavor="Chocolate" ) ) First( Filter( IceCream, Flavor="Strawberry" ) ) )
Removes two records from the data source.

The IceCream data source has been modified.
RemoveIf( IceCream, Quantity > 150 ) Removes records that have a Quantity that's greater than 150.

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.


The IceCream data source has been modified.
RemoveIf( IceCream, true ) Removes all records from the data source.

The IceCream data source has been modified.

Step by step

  1. Import or create a collection named Inventory, and show it in a gallery as Show data in a gallery describes.

  2. In the gallery, set the OnSelect property of the image to this expression:
    Remove(Inventory, ThisItem)

  3. Press F5, and then select an image in the gallery.
    The item is removed from the gallery and the collection.