Elements of a Table in Power Apps

In this exercise, we will learn about the Elements of a table in Power Apps.

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

Elements of a table in Power a

Let’s explain each element of the 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 Ashish, we would use the following formula.

PowerApps Formula

LookUp(MyFriends, Name = "Ashish")

This would return the entire record for the Ashish name.

Create Records in Power apps We can create records also by using curly braces {}. For example, this record { Name: "Ashish", Experience: 7.99 } isn't associated with a table. Note that field names, such as Name and Experience in the record, aren't enclosed in double quotation marks.

b) Table

A table holds one or more records. We can create a table using the Table function in power apps.

Example:

PowerApps Formula

Table( { Value: "Ashish" }, { Value: "Katrina" } )

The above formula contains the single column table with column name Value. We can also define a single-column table with square brackets. An equivalent way to write the above code:

PowerApps Formula

[ "Ashish", "Katrina" ]

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 from the record by using the decimal (.) operator on the record.

Syntax Record.Column_Name

For example, LookUp(MyFriends, Name = "Ashish").City returns the value Sonipat. 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.

Syntax Table.Column_name

The above syntax returns the entire column values from the table.

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.