How to Remove a Column from Power Apps Collection?

Do you know how to remove a column from a Power Apps collection? This Power Apps tutorial will explain how to remove a column from Power Apps collection using different examples.

How to Remove a Column from Power Apps Collection

Here, we will discuss two ways to remove a column from the Power Apps collection. Such as:

  1. Remove Column from Power Apps Collection using DropColumns()
  2. How to Remove Column from Power Apps Collection using ShowColumns()

Remove Column from Power Apps Collection using DropColumns()

Let’s see how to remove a column from the Power Apps collection using a DropColumns() function with a simple example.

Example:

I have a Power Apps collection, i.e., [ “Expenses Collection”], which contains the below records with respective columns.

Remove Column from the Power Apps Collection

As in the screenshot below, I want to remove an unwanted column [Amount] using the DropColumns() function.

How to Remove Column from a Power Apps Collection

To achieve it, follow the below-mentioned steps. Such as:

1. Create a Blank canvas app -> Select App object [From the left navigation] and set its OnStart property as:

OnStart = ClearCollect(
    colExpenses,
    {
        Item: "Grocery",
        Category: "Food",
        PurchasDate: "8/30/2023",
        Amount: 1000
    },
    {
        Item: "Wallpapers",
        Category: "Household",
        PurchasDate: "8/31/2023",
        Amount: 1500
    },
    {
        Item: "Cab ride",
        Category: "Car/Trasport",
        PurchasDate: "9/1/2023",
        Amount: 900
    },
    {
        Item: "Health checkup",
        Category: "Ford",
        PurchasDate: "9/2/2023",
        Amount: 2200
    },
    {
        Item: "Grocery",
        Category: "Food",
        PurchasDate: "8/30/2023",
        Amount: 1000
    },
    {
        Item: "Cab ride",
        Category: "Car/Trasport",
        PurchasDate: "9/1/2023",
        Amount: 900
    },
    {
        Item: "Loan payments",
        Category: "Personal",
        PurchasDate: "9/3/2023",
        Amount: 2000
    }
)

Where,

  • colExpenses = Power Apps Collection
  • Item, Category, PurchasDate, Amount = Collection Headers/Columns
  • “Grocery”, “Food”, etc… = Collection Records/Rows
Remove Column from Power Apps Collection

2. I want to remove an unwanted column [Amount]. For that, use the code below in the App’s OnStart property:

OnStart = ClearCollect(
    colRemoveColumn,
    DropColumns(
        colExpenses,
        "Amount"
    )
)

Where,

  • colRemoveColumn = Power Apps Collection
  • DropColumns() = This function is used to remove an unwanted column
  • colExpenses = Power Apps Source Collection
  • “Amount” = Collection Unwanted column
Remove a Column from Power Apps Collection

3. To get the created collection, click on the App’s Run OnStart property as shown below.

How to Remove Column from Power Apps Collection

4. Then, insert a Data table and set its Items property to the code below:

Items = colRemoveColumn

5. To display the collection fields on a data table, click on the Edit fields as shown below.

How to Remove a Column from Power Apps Collection

6. Save, Publish, and Preview the app. The data table will remove an unwanted column and display the remaining columns below.

How to Remove Column from the Power Apps Collection

This is how to remove a column from the Power Apps collection using a DropColumns() function.

Remove Column from Power Apps Collection using ShowColumns()

In the same way, I will show you how to remove a column from the Power Apps collection using a ShowColumns() function with a simple example.

Example:

I will also take the above Power Apps collection [colExpenses] for this example. Now, I want to remove an unwanted column [Amount] from the Power Apps collection using a ShowColumns() function.

Refer to the below screenshot:

Remove Column from a Power Apps Collection

To do so, follow the below steps. Such as:

1. On the Power Apps Screen -> Insert a Button control and set its OnSelect property as:

OnSelect = ClearCollect(
    colDeleteColumn,
    ShowColumns(
        colExpenses,
        "Item",
        "Category",
        "PurchasDate"
    )
)

Where,

  • colDeleteColumn = Collection Name
  • ShowColumns() = This function is used to display all the collection fields instead of unwanted column
  • colExpenses = Source Collection
Remove a Column from the Power Apps Collection

2. Then, insert a Data table and set Its Items property as:

Items = colDeleteColumn

3. To display the collection fields on the data table, click on the Edit fields as shown below.

Remove an Unwanted Column from Power Apps Collection

3. Save, Publish, and Preview the app. Whenever the user clicks on the button control, the data table displays collection fields instead of an unwanted column, as shown below.

Remove an Unwanted Column from the Power Apps Collection

This is how to remove a column from the Power Apps collection using a ShowColumns() function.

Conclusion

This Power Apps tutorial explained all the information about how to remove a column from the Power Apps collection in two ways. Such as:

  1. Remove Column from Power Apps Collection using DropColumns()
  2. How to Remove Column from Power Apps Collection using ShowColumns()

Additionally, you may like some more Power Apps tutorials:

>