How to Add a Lookup Column to Power Apps Collection

In this Power Apps tutorial, I will explain How to Add a Lookup Column to Power Apps Collection. Then, we will discuss how to add two related Power Apps collections.

Also, I will show you how to add a column in the respective Power Apps Collection and bring the value from another collection lookup column.

Furthermore, we will discuss how to add SharePoint LookUp column to Power Apps collection with a simple scenario.

If you want to learn how to create Power Apps Collection, then refer this complete tutorial: How to Create a Power Apps Collection

Add a Lookup Column to Power Apps Collection

Power Apps LookUp Function identifies the first table entry corresponding to a formula. We can use the Power Apps LookUp () function to find a record matching one or more criteria.

  • For example, I have two Power Apps Collections, i.e., colProductDetails [1st image] and colProducts [2nd image].
  • The first collection [colProductDetails] has the below headers:
ColorProductIDProductName
  • The second collection [colProducts] has the below headers:
PriceProductID

Now, I want to look up this Price column to the 1st collection, i.e. [colProductDetails], and the result will be stored in a new collection, i.e. [colFinal]. Refer to the table below:

ColorPriceProductIDProductName

Also, refer to the image below:

How to Add a Lookup Column to Power Apps Collection

To achieve the above example, follow the below-mentioned steps. Such as:

  • Open Power Apps with your credentials and create the Power Apps Canvas app where you want to add a lookup collection.
  • Then, select the App (from the left navigation) and choose the OnStart property to create collections like below.
OnStart = ClearCollect(colProductDetails,{ProductID:"SP001",ProductName:"Torch",Color:"Red"},{ProductID:"SP002",ProductName:"Rice cooker",Color:"White"},{ProductID:"SP003",ProductName:"Mobile Phone",Color:"Black"},{ProductID:"SP004",ProductName:"Digital camera",Color:"Brown"},{ProductID:"SP005",ProductName:"Mixer",Color:"Grey"});
ClearCollect(colProducts,{ProductID:"SP001",Price:200},{ProductID:"SP002",Price:400},{ProductID:"SP003",Price:1000},{ProductID:"SP004",Price:800},{ProductID:"SP005",Price:700})

Where,

  1. colProductDetails= Collection Name
  2. ProductID, ProductName, Color = Collection Headers/Columns
  3. SP001“, “Torch“, “Red“… = Collection Values/Records
  4. colProducts = Second Collection Name
  5. ProductID, Price = Second Collection Headers
  6. SP001“, “200“… = Second Collection Records
Power Apps Collection Add a LookUp Column
  • Next, click on the More commands () option and click on the Run OnStart option to get our collection.
  • Then, go to the Variables section (x) -> Select Collections drop-down to find collections, as shown below.
How to Add Power Apps Collection LookUp Column
  • Also, if you want to see your created collections, click the View Table option and select the respective collection like below.
How to Add a Power Apps Collection LookUp Column
  • But here, we need to add a column in the respective collection (colProductDetails) based on the lookup column in another collection (colProducts).
  • To do so, insert another screen -> add a Button control -> Set its OnSelect property to the code below:
OnSelect = ClearCollect(colFinal,AddColumns(colProductDetails,"Price",LookUp(colProducts,ProductID=colProductDetails[@ProductID],Price)))

Where,

  1. ClearCollect = We can use this function to delete all records from the collection and add a different set of records to the same collection.
  2. colFinal = You can set a collection to add a lookup column.
  3. AddColumns = This function helps to add a column to the collection.
  4. colProductDetails = It is 1st name of the Power Apps collection.
  5. “Price” = This is the lookup column I want to add to the 1st collection.
  6. LookUp = You can use this function to find a record matching one or more criteria.
  7. colProducts = It is 2nd name of the Power Apps collection.
  8. ProductID = This is a lookup column that we used in both collections.
power apps addcolumns lookup
  • Then, insert a Data table and set its Items property as:
Items = colFinal
  • Also, you can add some collection fields from the Edit fields option [from the Properties pane].
How to Add a LookUp Column from Power Apps Collection
  • Now, click on the button control [Add LookUp column] to display the records and especially, and we can get the price column based on the lookup column as shown below.
Add LookUp Column in Power Apps Collection
  • Also, if you want to find the final collection, go to the Variables section, click on the Collections drop-down, and select a respective collection (colFinal) like the one below:
Add a LookUp Column in Power Apps Collection

This is all about adding a lookup column in a Power Apps collection.

Add SharePoint LookUp Column to Power Apps Collection

Let’s take a simple scenario: I have two SharePoint Online lists, i.e., Employee Department [1st image] and Employee Onboarding [2nd image].

Employee Department:

ColumnData type
Employee DepartmentIt is a default single line of text renamed “Employee Department
Department ManagerIt is a single line of text

Employee Onboarding:

ColumnData type
Employee DepartmentIt is a lookup column that we created from a source list [Employee Department]
Department ManagerIt is an additional lookup column from the source list

I want to add these lookup columns to my Power Apps collection, i.e., [Employeecol], and display the collection with lookup columns in a gallery control [3rd Image]. Refer to the below image.

Add SharePoint LookUp Column in Power Apps Collection

To achieve the above example, follow the below-mentioned steps. Such as:

  • Open Power Apps with your credentials and create the Power Apps Canvas app where you want to add a lookup collection.
  • Then, we should add a SharePoint Online list to our Power Apps Canvas app like the one below.
Add SharePoint Online LookUp Column in a Power Apps Collection
  • Now, select the App (from the left navigation) and choose the OnStart property to create a collection from a SharePoint Online list.
OnStart = ClearCollect(Employeecol,'Employee Onboarding')

Where,

  1. Employeecol = Collection Name
  2. ‘Employee Onboarding’ = SharePoint Online List
How to Add SharePoint LookUp Column to Power Apps Collection
  • Next, click on the Run OnStart option to get our collection -> Go to the Variables section (x) -> Select Collections drop-down to find collections like below.
How to Add a SharePoint LookUp Column to Power Apps Collection
  • But, here we need to add a lookup column in a gallery control using our collection [Employeecol]. To do so, select the default screen, add a Gallery control, and set its Items property as:
Items = Employeecol
How to Add a SharePoint LookUp Column in Power Apps Collection
  • Also, you can add lookup column fields from the Edit option [From the Properties pane] -> Set its Text property as:
Text = ThisItem.'Employee Department'.Value
Text = ThisItem.'EmployeeDepartment: Department Manager'.Value

Where, ThisItem.’Employee Department’.Value, ThisItem.’EmployeeDepartment: Department Manager’.Value are lookup columns that we will get from the SharePoint source list.

Add SharePoint LookUp Column to Power Apps Canvas app Collection
  • Now, we can get the lookup columns in our Power Apps collection as shown below.
Add SharePoint Online LookUp Column in Power Apps Collection

This is all about how to add a SharePoint lookup column to the Power Apps collection.

Additionally, you may like some more Power Apps tutorials:

Conclusion

Whenever we create two related Power Apps collections, you can easily add a lookup column based on the same column in both collections.

Here, from this Power Apps tutorial, we learned all about the Power Apps collections and added a lookup column. Then, we saw how to add a lookup column from a Power Apps collection.

Also, we covered how to display the Power Apps collection using a data table and find our collections under the variables section.

And finally, we discussed how to add SharePoint LookUp column to Power Apps collection with a simple scenario.