The Table function in PowerApps is used to
create a table from a set of records. This function is particularly useful when
you need to construct a table of data manually or manipulate data structures
within your app.
PowerApps – Table() function Syntax
Table(Record1
[, Record2, ...])
Table(Untyped)
- Record1, Record2, ...: The records to include in the
table.
- Untyped objectthat represents a table
or array.
Notes:
- Table
function doesn’t create a permanent
table in data verse or anywhere.
- A table is a
value in Power Apps, just like a string or a number.
- Using the Table function to create large tables or
complex data structures can impact
performance. Ensure that your use cases are optimized for performance,
especially in mobile environments.
PowerApps - Create a Simple Table with Two Records
Suppose you want to create a table with information
about two products:
Table(
{ ProductName: "Laptop", Price:
1000, InStock: true },
{ ProductName: "Mouse", Price:
25, InStock: false }
)
This creates a table with two records, each containing
ProductName, Price, and InStock fields.
PowerApps - Create a Table with Multiple Fields
You can include as many fields as needed in each
record:
Table(
{ Name: "John", Age: 30, City:
"New York" },
{ Name: "Alice", Age: 25, City:
"Los Angeles" },
{ Name: "Bob", Age: 28, City:
"Chicago" }
)
This creates a table with records of people, including
their name, age, and city.
PowerApps – Create a temp Data
Source for a Gallery using Table function
You can use the Table function to create a small data source for a gallery
control. For example, to display a list of items in a gallery:
Gallery1.Items
= Table(
{
Item: "Item 1", Quantity: 10 },
{ Item: "Item 2", Quantity: 5 },
{ Item: "Item 3", Quantity: 20 }
)
PowerApps – Set Temporary Data Storage using Table function
Use the Table function to store temporary data within your app,
such as user selections or calculations:
Set(SelectedItems,
Table(
{ ID: 1, Name: "Option A" },
{ ID: 2, Name: "Option B" }
))
PowerApps - Combine Data from Different Sources using Table function
You can use the Table function to combine data from different sources into
a single table. For example, combining static data with dynamic data:
Collect(
CombinedData,
Table(
{ Source: "Static", Value:
"Static Value 1" },
{ Source: "Static", Value:
"Static Value 2" }
),
DynamicDataSource
)