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 Name | Data Type |
Patient ID | This is a default single line of text; I just renamed it as “Patient ID.” |
Name | A single line of text |
DOB | Date and time |
Disease | Lookup |
This SharePoint lookup column [Disease] is added from another SharePoint source list named “Diseases List“. This list contains the below fields.
Source List:
Column Name | Data Type |
Disease | It is a default single line of text |
Doctor’s Name | A single line of text |
Doctor’s Experience | Number |
Doctor’s Fees | Currency |
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:
- How to Display SharePoint Lookup in Power Apps Data Table
- 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.
- Open Power Apps -> Create Power Apps Blank Canvas app and connect it to the SharePoint Online list [Patient Tracker].
- 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
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:
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].
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
2. Then insert a Dropdown control and set its Items property as:
Items = colDiseases
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
4. Finally, set the dropdown’s Default property to “All” to display all the SharePoint list records on the data table, as shown below.
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:
6. You can also filter and display the SharePoint list records based on the dropdown selected value, as shown below.
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:
- How to Filter SharePoint Online List in Power Apps
- Sum Column in Power Apps Data Table
- Filter Power Apps Data Table By Dropdown
- Change Date Format in Power Apps Data Table
- How to Set Alternate Row Color in Power Apps Data Table
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com