Latest Posts

PowerApps Create table with specific columns


The ShowColumns function in PowerApps is used to create a table that includes only specific columns from an existing table. This is useful when you need to work with a subset of data from a larger dataset, allowing you to streamline data handling and improve performance.

PowerApps – ShowColumns() function Syntax

ShowColumns(Table, ColumnName1 [, ColumnName2, ...])

  • Table: The source table from which you want to include columns.
  • ColumnName1, ColumnName2, ...: The names of the columns you want to include in the result table.

Notes:

·       Ensure that the columns you specify in ShowColumns exist in the source table. If you reference a column that does not exist, PowerApps will return an error.

PowerApps – Create table using existing table

Suppose you have a table named Employees with columns Name, Department, Title, and Salary. To create a new table with only the Name and Department columns:

ShowColumns(Employees, "Name", "Department")

This returns a table with just the Name and Department columns from the Employees table.

When populating a gallery with a large dataset, it is efficient to only include necessary columns. Suppose you have a table named Orders with multiple columns, and you want to display only OrderID, CustomerName, and OrderDate in a gallery:

Gallery1.Items = ShowColumns(Orders, "OrderID", "CustomerName", "OrderDate")

PowerApps – Form Submission with only few fields

When submitting a form, you might want to only include specific fields. Suppose you have a form that updates a Customer table with multiple fields, but you only want to submit CustomerName and Email:

SubmitForm(ShowColumns(EditForm1.Updates, "CustomerName", "Email"))

 

PowerApps – combine ShowColumns and Filter functions

You can combine ShowColumns with other PowerApps functions to create complex data manipulations. For example, filtering a table before selecting specific columns:

ShowColumns(Filter(Employees, Department = "Sales"), "Name", "Title")

 

This filters the Employees table to include only those in the Sales department, and then creates a table with only the Name and Title columns.

PowerApps - Nested Usage of SHowColumns with Sort function

If you need to use ShowColumns within other functions, you can do so to streamline the data being passed through the functions. For example, sorting a filtered dataset:

Sort(ShowColumns(Filter(Inventory, Quantity > 0), "ItemName", "Quantity"), Quantity, Descending)

This filters the Inventory table to include only items with a quantity greater than 0, selects the ItemName and Quantity columns, and then sorts the result by Quantity in descending order.


We value your Feedback:

Page URL:

Name:

 

Email:

 
 

Suggestion:

 

© 2024 Code SharePoint