When working with the Power Apps data table, sometimes we need to update the data table columns according to our needs. In this Power Apps tutorial, I will discuss how to update the data table columns or fields in Power Apps.
Additionally, we will also cover the below topics. Such as:
- Power Apps refresh data table
- Power Apps update collection column value
Power Apps Update Data Table Columns
Here, I will show you how to update Power Apps data table columns using different examples. Such as:
Example-1:
I have a SharePoint Online list named “Product Details” and this list contains the below fields.
Column Name | Data Type |
Product Name | It is a default single line of text |
Manufacturer | Choice |
Price | Currency |
Quantity | Number |
Purchase Date | Date and time |
In Power Apps, there is a Data table having the SharePoint list records. Whenever you connect the SharePoint list to the data table, the data table displays the default title column name [Product Name] as “Title.”
However, if you want to display the Title column name as “Product Name,” you can change the Header Text to Product Name under the Properties pane, as shown below.
Example-2:
In this example, I will show you how to display the Price column value after adding a 20% discount. To do so, select the Price_Column1 and set its Text property to the code below.
Text = ThisItem.Price*20/100 //You can change the discount value
Where,
- 20/100 = It is the value of the discount for the Price value
Example-3:
Suppose you want to combine and display the two column values [Product Name and Manufacturer] in one column [Product Name and Manufacturer]. To achieve it, follow the below code.
Text = ThisItem.Title & "/" & ThisItem.Manufacturer.Value
This is how we can work with the Power Apps data table columns.
Power Apps Refresh Data Table
Whenever you can use the Clear or Reset functions to refresh the Power Apps data table, you will get an error message [The function ‘Clear’ has some invalid arguments. Invalid argument type (Control). Expecting a Table value instead. The first argument of ‘Clear’ should be a collection.]
To resolve this issue, you can use the Power Apps collection. For that, select the App object and set its OnStart property to the code below.
OnStart = ClearCollect(colProducts,'Product Details')
Where,
- colProducts = Power APps collection name
- ‘Product Details’ = SharePoint Online list
Now, select the Data table control and set its Items property as:
DataSource = colProducts
Finally, insert a Reset icon and set its OnSelect property to the code below.
OnSelect = Clear(colProducts)
Once your app is ready, save, publish, and Preview the app. When the user clicks on the reset icon, it will reset the data table in Power Apps.
Have a look at the below screenshot for the output.
Power Apps update collection column value
Finally, I will show you how to update the Power Apps collection column value in the data table using a simple scenario.
Scenario:
I will also use the above Power Apps collection [colProducts] for this example. Now, I would like to display the whole amount [Price*Quantity] in the Price column using the code below.
Text = ThisItem.Price*ThisItem.Quantity
This is how we can work with the Power Apps update collection column value in the data table.
I hope this Power Apps tutorial is helpful for you; in this tutorial, we learned how to update the Power Apps data table columns using simple examples and discussed how to refresh the data table in Power Apps.
In the last, we covered Power Apps update collection column value using the data table.
Also, you may like:
- Display SharePoint Lookup Field in Power Apps Data Table
- Sum Column in Power Apps Data Table
- Change Date Format in Power Apps Data Table
- Filter Power Apps Data Table By Dropdown
- Power Apps Upload File to SharePoint Document Library
- 6 Easiest Ways to Filter Gallery in Power Apps
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