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:
- Remove Column from Power Apps Collection using DropColumns()
- 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.
As in the screenshot below, I want to remove an unwanted column [Amount] using the DropColumns() function.
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
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
3. To get the created collection, click on the App’s Run OnStart property as shown below.
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.
6. Save, Publish, and Preview the app. The data table will remove an unwanted column and display the remaining columns below.
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:
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
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.
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.
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:
- Remove Column from Power Apps Collection using DropColumns()
- How to Remove Column from Power Apps Collection using ShowColumns()
Additionally, you may like some more Power Apps tutorials:
- Remove Items From Power Apps Collection
- Count Rows in Power Apps Collection
- Power Apps Save Collection to SharePoint List
- Power Apps Split Text Into Collection
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com