How to Display SharePoint Lookup Field in Power Apps Data Table?

In this Power Apps tutorial, we will see how to display SharePoint Lookup field in Power Apps Data table.

Additionally, I will explain how to filter the SharePoint lookup in the Power Apps Data table using a Dropdown control with a simple scenario.

How to Display SharePoint Lookup Field in Power Apps Data Table

Let’s take a simple scenario:

I have a SharePoint Online List named [Patient Tracker] and this list contains the below fields.

Destination List:

Column NameData Type
Patient IDThis is a default single line of text; I just renamed it as “Patient ID.”
NameA single line of text
DOBDate and time
DiseaseLookup
Display SharePoint Lookup in Power Apps Data Table

This SharePoint lookup column [Disease] is added from another SharePoint source list named “Diseases List“. This list contains the below fields.

Source List:

Column NameData Type
DiseaseIt is a default single line of text
Doctor’s NameA single line of text
Doctor’s ExperienceNumber
Doctor’s FeesCurrency
How to display SharePoint list in PowerApps data table with lookup

Now, I would like to display all the records of the destination list [Patient Tracker] in the Power Apps data table with the lookup column, i.e., [Disease], using two ways. Such as:

  1. How to Display SharePoint Lookup in Power Apps Data Table
  2. Filter SharePoint Lookup in Power Apps Data Table using Dropdown

Display SharePoint Lookup in Power Apps Data Table

First, let me explain how to display or retrieve all the SharePoint list records in the Power Apps data table using the lookup field. To achieve this, follow the steps below.

  1. Open Power Apps -> Create Power Apps Blank Canvas app and connect it to the SharePoint Online list [Patient Tracker].
  2. Insert a data table control on the Power Apps screen and set its Items property to the code below:
Items = 'Patient Tracker'

Where,

  • ‘Patient Tracker’ = SharePoint Online List
How to Display SharePoint Lookup Field in Power Apps Data Table

3. Whenever you connect the respective SharePoint list to the data table, it will display all the list records, including the lookup column records.

Have a look at the below screenshot for the output:

How to Show SharePoint Lookup Field in Power Apps Data Table

4. If you can not see the SharePoint lookup column in the Power Apps Data table, you can add it using the Fields option [Fields -> + Add field -> Choose field -> Add].

Display SharePoint Lookup Field in PowerApps Data Table Control

This is the normal way to display the SharePoint lookup field in the Power Apps Data table control.

Filter SharePoint Lookup in Power Apps Data Table Using Dropdown

Next, I will show you how to Filter the SharePoint list lookup records on the Power Apps data table using a dropdown menu. To do so, follow the below steps.

1. Select the Power Apps Screen and set its OnVisible property as:

OnVisible = ClearCollect(
    colDiseases,
    {Value: "All"}
);
Collect(
    colDiseases,
    Distinct(
        'Diseases List',Disease
    )
)

Where,

  • colDiseases = Power Apps collection name
  • Value: “All” = We can add All value to the dropdown to display all the sharePoint list records
  • ‘Diseases List’ = SharePoint source list
  • Disease = SharePoint list field
Filter SharePoint Lookup in Power Apps Data Table Using Dropdown

2. Then insert a Dropdown control and set its Items property as:

Items = colDiseases
How to Display the SharePoint Lookup Field in PowerApps Data Table

3. Now, insert a data table control and set its Items property to the code below.

Items = If(
    drp_Lookup.Selected.Value = "All",
    'Patient Tracker',
    Filter(
        'Patient Tracker',
        Disease.Value = drp_Lookup.Selected.Value
    )
)

Where,

  • ‘Patient Tracker’ = SharePoint destination list
  • drp_Lookup = Power Apps dropdown name
How to Display the SharePoint Lookup Field in Power Apps Data Table

4. Finally, set the dropdown’s Default property to “All” to display all the SharePoint list records on the data table, as shown below.

Display SharePoint Lookup Field in the Power Apps Data Table

5. Once your app is ready, Save, Publish, Reload, and Preview the app. Whenever the user opens or runs the app, the data table displays all the SharePoint list records based on the dropdown lookup value [“All”].

Refer to the below screenshot:

Display SharePoint Lookup Field in the PowerApps Data Table

6. You can also filter and display the SharePoint list records based on the dropdown selected value, as shown below.

Filter SharePoint Lookup in PowerApps Data Table Using Dropdown

This way, you can filter the SharePoint list in the Power Apps data table with a lookup field.

I hope this article is useful for you. If you have any requirements related to displaying a SharePoint list record on the Power Apps data table using a lookup field, you can follow the two ways mentioned above.

Also, you may like below articles:

>