Canvas Apps Controls

Data tables – New vs Old

Power Apps Data Tables
Power Apps Data Tables

Data Tables

Data tables in Power Apps shows data in a tabular format. You can select multiple columns to display in the table. Each column comes with a column header.

Data Tables v1

The Power Apps team introduced data tables on May 5, 2017. With data tables, you can select a data source and the fields that you want to display. There are several properties that are available for each column. These include:

  • AutoWidth/Can grow - to control whether the width of the column should be set automatically based on data
  • DisplayName/Text - the name of the column header
  • IsHyperlink - to make a column perform any behavior formulas like Navigate, Set, etc. using its OnSelect property
  • OnSelect - to specify what formulas should be invoked if the column's IsHyperlink property has been set to true
  • Visible - to control the visibility of the column
  • Width - to control the width of the column if the AutoWidth is set to false

The problem with this properties set is that you cannot specify a calculation or any kind of formatting for the value of a column. For example, a date field that you may want to format in several different ways. Another example is a column for a lookup field. Here is an example of a data table that has its data source set to the Accounts entity in CDS:

Old data tables in Power Apps
Old data tables in Power Apps

As you can see, adding the Primary Contact column (which is a lookup column to the Contacts entity) displays no value. Also, if you want to show the primary contact's full name or the city in which they reside, you are out of luck.

Data Tables v2

To overcome this limitation, the Power Apps team announced a new version of data tables on June 17, 2019 as an experimental feature. This has since evolved into a preview feature. To enable this feature, go to File->Settings->Advanced settings. Then look for the setting "Enable improved data table control selection and Value property and turn it on.

Enabling the new data table control
Enabling the new data table control

As the description says, the two main features of this new control are:

  • The field selection experience is consistent with forms
  • More importantly, you can now specify a Value property for each column allowing for calculations and formatting

The list of properties for each column has been enhanced with the following changes/additions:

  • FieldDisplayName/Header Text - the old DisplayName property has been renamed FieldDisplayName. It controls the column header name
  • Order - a numeric value that controls the order in which the columns should appear in the table
  • Text - the value that should be displayed for each column. As a result, you can format and use calculations to specify a value using the This operator just like in a gallery

Here is an example of this new data control using the same data source as in the above example:

New data tables in Power Apps
New data tables in Power Apps

With this new control, I can now specify the value I want to show for the Primary Contact column. So if I want to display the full name of the primary contact, I can use

ThisItem.'Primary Contact'.'Full Name'

Summary

To summarize, the original data table control does not allow makers to specify the value that should be displayed for each column. However, the new version (in preview mode) does. This new control has been available for quite some time now. However, it is easy to miss this feature if the setting hasn't been turned on. I created an app recently and the setting to enable the new data table control was turned off. In turn, this prevented me from doing calculations or formatting of values for each column. That's when I realized that the data table control that I have been relying on for months is a feature that has to be turned on. For this reason, I wanted to share this with you all so you could turn this feature on for every app until this becomes the standard control.

Related Articles

  1. Adding Show/Hide Columns capability to Data Tables
  2. Flexible Height Galleries – A quick intro
  3. Power Apps Formula Reference
  4. Official blog post for the old data table control
  5. Official blog post for the new data table control
  6. Data table control in Microsoft Docs

1 thought on “Data tables – New vs Old”

Leave a Reply