How To Use AddColumns, RenameColumns, DropColumns, ShowColumns Formula In Canvas APPs(Power Fx)

Introduction

In this article, we are going to see about what PowerApps Formula reference is and how it is useful to develop Power Platform Applications.

PowerApps is a service-oriented application used for developing custom apps for your organization.

Easily develop mobile and web apps for any business need—even if you have no technical or development experience—with Power Apps. 

PowerApps helps us create simple apps quickly. Through PowerApps templates, we can customize our applications. With PowerApps, we can connect to our company data coming from

  • Oracle
  • SAP
  • Salesforce
  • Office365
  • Azure
  • Excel/CSV Files

It simplifies the development cycle of the business apps and equips the business users and developers to build custom native, mobile, and web applications.

Launch Canvas App

The steps are given below to create a Power App based on On-Premises data.

  • Login to Office 365 SharePoint site and click the list, where you want to add PowerApps.
  • Click PowerApps link in the list ribbon given below.
  • Enter the PowerApps name and it will redirect to the PowerApps Studio.

Click blank App.

Power Fx

  1. Microsoft Power Fx is the new name for the formula language for canvas app
  2. Power Fx is expressed in human-friendly text.
  3.  It's a low-code language that makers can work with directly in an Excel-like formula bar or Visual Studio Code text window.

In this article, we are going to test below PowerFx formulas with real time example.

  • AddColumns
  • RenameColumns
  • DropColumns
  • ShowColumns

Here, I have created a Table with sample collection on APP start of the PowerApps Application.

Create a simple Collection To Load the values into Table for our testing

Add Data Table to display the Collection to view

ADD COLUMNS

The AddColumns function adds a column to a table, and a formula defines the values in that column, but the existing columns remain unmodified in our collection /Table.

Syntax

AddColumns( Table, NewColumnName1FormulaAction )

Lets see in Detail with sample example

In our sample Collection I would like to add new Column to show multiple of Number into 100 the formula should be

AddColumns(DemoCollection,"New Column",Number*100)

Output

DropColumns

The RemoveColumns function  drop the existing column to a table, and a formula defines the values in that column, but the existing columns remain unmodified in our collection /Table.

Syntax

DropColumns( Table, “ColumnName1)

Excludes the Number column from the result.

DropColumns(DemoCollection,"Number")

Output

ShowColumns

The ShowColumns include only the Number column in the result. Use this function to include columns, and use DropColumns to exclude them.

Syntax

ShowColumns( Table, “ColumnName1)

ShowColumns(DemoCollection,"Number")

Output

RenameColumns

The RenameColumns function renames the existing column to a table, and a formula defines the values in that column, but the existing columns remain unmodified in our collection /Table.

Syntax

RenameColumns( Table, “ColumnName1)

Excludes the Number column from the result.

RenameColumns(DemoCollection,"Number",”Renamed Number”)

Output

Conclusion

PowerFx is a language, and anybody can learn with basic logical thinking ideas on the programming side. PowerApps gives you the ability to connect with all kinds of data, which is not only available with your Tenant but connected to it via the Data Management Gateways.

PowerApps is truly the future of building custom forms and then making them available on mobile devices for your organization.

Was my article helpful? If yes, please let me know and if not, please explain what was confusing or missing. I’ll use your feedback to double-check the facts, add info and update this article.


Similar Articles