Legen Sie noch heute los
Geben Sie die Informationen Ihres Geschäfts-, Schul- oder Unikontos ein, um loslegen zu können.
These functions shape a table by adjusting its columns:
A table is a value in PowerApps, just like a string or a number. You can specify a table as an argument in a formula, and functions can return a table as a result. The functions that this topic describes don't modify a table. Instead they take a table as an argument and return a new table with a transform applied. See working with tables for more details.
You can't modify the columns of a data source by using these functions. You must modify the data at its source. You can add columns to a collection with the Collect function. See working with data sources for more details.
The AddColumns function adds a column to a table, and a formula defines the values in that column. Existing columns remain unmodified.
The formula is evaluated for each record of the table.
Fields of the record currently being processed are available within the formula. You simply reference them by name as you would any other value. You can also reference control properties and other values from throughout your app. For more details, see the examples below and working with record scope.
The DropColumns function excludes columns from a table. All other columns remain unmodified. DropColumns excludes columns, and ShowColumns includes columns.
The RenameColumns function renames columns of a table. All other columns retain their original names.
The ShowColumns function includes columns of a table and drops all other columns. You can use ShowColumns to create a single-column table from a multi-column table. ShowColumns includes columns, and DropColumns excludes columns.
For all these functions, the result is a new table with the transform applied. The original table isn't modified.
When used with a data source, these functions cannot be delegated. Only the first portion of the data source will be retrieved, up to 500 records, and then the function applied. The result may not represent the complete story. A blue dot will appear at authoring time to remind you of this limitation and to suggest switching to delegable alternatives where possible. See the delegation overview for more information.
AddColumns( Table, ColumnName1, Formula1 [, ColumnName2, Formula2, ... ] )
DropColumns( Table, ColumnName1 [, ColumnName2, ... ] )
RenameColumns( Table, OldColumneName, NewColumnName )
ShowColumns( Table, ColumnName1 [, ColumnName2, ... ] )
The examples in this section use the IceCreamSales data source, which contains the data in this table:
None of these examples modify the IceCreamSales data source. Each function transforms the value of the data source as a table and returns that value as the result.
|AddColumns( IceCreamSales, "Revenue", UnitPrice * QuantitySold )||Adds a Revenue column to the result. For each record, UnitPrice * QuantitySold is evaluated, and the result is placed in the new column.|
|DropColumns( IceCreamSales, "UnitPrice" )||Excludes the UnitPrice column from the result. Use this function to exclude columns, and use ShowColumns to include them.|
|ShowColumns( IceCreamSales, "Flavor" )||Includes only the Flavor column in the result. Use this function include columns, and use DropColumns to exclude them.|
|RenameColumns( IceCreamSales, "UnitPrice", "Price")||Renames the UnitPrice colum in the result.|
AddColumns( IceCreamSales, "Revenue",
UnitPrice * QuantitySold ),
"UnitPrice", "Price" ),
|Performs the following table transforms in order, starting from the inside of the formula: |
Import or create a collection named Inventory as the first subprocedure in Show text and images in a gallery describes.
Add a button, and set its OnSelect property to this formula:
ClearCollect(Inventory2, RenameColumns(Inventory, "ProductName", "JacketID"))
Press F5, select the button that you just created, and then press Esc to return to the design workspace.
On the File menu, select Collections.
Confirm that you've created a collection, named Inventory2. The new collection contains the same information as Inventory except that the column named ProductName in Inventory is named JacketID in Inventory2.