Elements of a Table and Table function in Power Apps

1. Elements of a table

Let the table will be assumed to be from a data source named MyFriends.

Elements of a table

a) Records

A record means row in a table. The most common way to retrieve a record from a table is to use the LookUp function.

For example, to return the record where the Name column value is Siddhant, we would use the following formula.

PowerApps Formula

LookUp(MyFriends, Name = "Siddhant")

This would return the entire record for the Siddhant name.

b) Table

A table holds one or more records.

c) Fields

A field is an individual piece of information in a record. We can visualize this as a value in a column for a record.

As with a control, we refer to a field of a record by using the decimal (.) operator on the record.

For example, LookUp(MyFriends, Name = "Siddhant").City returns the value Champaran. We could display this output in a Label control or use it with other controls or functions within our app where we need to reference the value.

d) Columns A column refers to the same field for one or more records in a table. The above table has three columns, shown horizontally across the top:

The column's name reflects the fields in that column. All values within a column are of the same data type. The "Marks" column of Number data type always contains a number and cannot contain a string. The value of any field can also be blank.

Sometimes we need to reference an entire column for a function or control. For example, if we want to use the Name column to populate the choices in a drop-down control. We could reference the Name column by setting the Items property for the drop-down control to MyFriends.Name. This would then populate the drop-down control with Ashish, Gaurav, Siddhant and Richa.

2. Table function in power apps

We can create a table in the power apps manually by using the Table function. This might be to populate a Dropdown control or to define information to be used in a Gallery or Data table control.

The Table function allows us to create a table of data that only exists in the context, which it is used within our app. For example, in the Items property of a Data table. The formula would be as follows.

PowerApps Formula

Table(
{FirstName: "Ashish", LastName: "Goel", ZipCode: 131001},
{FirstName: "Abhishek", LastName: "Bachhan", ZipCode: 456785},
{FirstName: "Ayesha", LastName: "Sharma", ZipCode: 4533257},
{FirstName: "Priya", LastName: "Verma", ZipCode: 678537}
)
Table function in Power Apps

To see the items appear in the Table, be sure to Edit fields in Properties.

Sometimes we need a simpler, single column Table for populating a Dropdown control choices. In that instance you can use the short cut method of [ ] to create a single column table. An example of creating a single column table is shown below.

PowerApps Formula

["Ashish", "Harsha", "Juhi"]

By placing that formula in the Items property of a Dropdown control, we will see the following.

Table function in Power Apps
Table function in Power Apps