What is the DropColumns Function?
The DropColumns function is a Power Fx formula that lets you remove one or more columns from a table. This function takes two arguments: the name of the table and a list of columns to remove. You can use this function to remove columns from any type of data source, including SharePoint lists, Excel tables, and SQL databases.
How to Use the DropColumns Function
To use the DropColumns function, you need to follow these steps:
1. Open your Power Apps application and navigate to the screen where you want to use the function.
2. Click on the formula bar at the top of the screen to open the formula editor.
3. Type the name of the table you want to remove the columns from followed by a period and the word “DropColumns”. For example, if you want to remove columns from a table named “MyTable”, you would type “MyTable.DropColumns”.
4. Inside the parentheses, list the names of the columns you want to remove as strings, separated by commas. For example, if you want to remove columns named “Column1” and “Column2”, you would type “MyTable.DropColumns(“Column1”, “Column2″)”.
5. Press Enter to apply the formula to your app.
Using the DropColumns Function in Practice
Let’s say you have a table named “Customers” that contains the following columns:
You want to remove the “CustomerPhone” column from the table. Here’s how you would use the DropColumns function to do that:
This will remove the “CustomerPhone” column from the “Customers” table.
Removing Multiple Columns
What if you want to remove more than one column from a table? You can do that by listing the names of the columns you want to remove as strings, separated by commas. For example, to remove both the “CustomerPhone” and “CustomerAddress” columns from the “Customers” table, you would use the following formula:
This will remove both the “CustomerPhone” and “CustomerAddress” columns from the “Customers” table.
The DropColumns function is a useful tool for removing unwanted columns from your data sources in Power Apps. By following the steps outlined in this article, you can quickly and easily remove one or more columns from your tables. Whether you are working with SharePoint lists, SQL databases, or Excel tables, the DropColumns function can help you streamline your app development process.