Essentially, the PowerApps lookup function returns the first record from a table based on one or more conditions or formulae. Interesting? This blog uncovers the logic behind the PowerApps lookup function, its syntax, and its different types. Mainly, you can understand the application of PowerApps lookup functions with suitable examples by reading this blog. Also, you can learn how to set up lookup fields in Dynamics 365 in detail.
Power Apps is a Microsoft product with which we can build custom business apps quickly. We can easily connect the apps with various data sources such as Dynamics 365, Microsoft 365, etc. Besides, we can run the apps on any platform – desktop, Tablet, or Mobile.
Know that PowerApps lookup is one of the essential aspects of Power Apps. PowerApps lookup function identifies the first record in a table based on conditions. Not only that, this lookup function allows using multiple conditions or formulas based on requirements. The formulae can match with various records in a table, but the PowerApps lookup function returns only the first record.
In this blog, you will walk through what is PowerApps lookup function, its syntax, how to apply the lookup function for different scenarios, and much more.
Power Apps Lookup - Table Of Contents
As you know, you can find the first record in a table with the help of the Power Apps lookup function based on a condition or formula. The formula is one of the parts of the lookup function. If you need to get a single value instead of a row or record, the lookup function allows you to achieve that. The only thing you must do is write the lookup function in the required way. It is essential to note that if no record matches the formula given in the lookup function, it returns ‘blank’.
When running the Power Apps lookup function, the formula is evaluated at each record of a table. The records that are true, or in other words, the records that match the criteria, will be added to the result table.
You can retrieve required information from various data sources using the Power Apps lookup function. It helps individuals and organizations to look up values quickly. Also, it allows them to retrieve information based on different conditions.
There are three types of lookups in Power Apps:
Let’s have a look at them in detail.
Simple LookUp:
This is a simple and easy-to-implement Power Apps lookup function. This function selects a single row from a table based on one or more conditions given in the lookup function.
PartyList-type Lookup:
Using this Power Apps lookup function, we can select multiple records from multiple tables. Every row is added to the result table. Mainly, every time we add a record to the table, it allows searching for a new record in the tables. It is essential to note that we can’t customize the system as well as disable views in this lookup type.
getlsPartyList is the client API reference that returns a boolean value to indicate that it is a party-type lookup. It means that if the lookup function returns true, then it is a party list lookup. If it returns false, then it is not the party-type lookup. Usually, party list lookups allow setting multiple records. The syntax for this lookup type is given as follows:
Regarding type Lookup:
We can use this Power Apps lookup to find a single record from multiple tables. If we want to use this lookup type, we must enable the ‘activities’ of a table. Moreover, it is an advanced lookup function that is highly useful to organizations, teams, and even individuals. Its improved capabilities simplify lookup operations significantly. It also supports intelligent authoring, which plays a pivotal role in application development.
Once regarding type lookup function is enabled, we can find the function in the lookup columns so that we can create as well as forms easily. Also, we can change settings and sort rows. Besides, we can change tables within a lookup column.
With the help of client APIs, we can customize this function. For example, we can create a new view for the dialogue box. Also, we can remove functions defined for the PreSearch event. Similar to removal, we can add custom filters using client APIs.
Learn end-to-end PowerApps concepts through the PowerApps Course in Hyderabad to take your career to a whole new level!
The syntax of the Power Apps LookUp function is given below:
The formula is another mandatory part of the Power Apps lookup function. The formula helps to identify the records that match one or more conditions or criteria. The formula evaluates every record in tables. You can find the syntax as ‘condition’ above the function box.
The reduction formula is the optional part of the Power Apps lookup syntax. You can use this part if you want a single value resulting from a lookup function instead of a record or records. In other words, the reduction formula converts a single record into a single value. You can find the syntax as ‘result’ above the function box.
As you know, we use the Power Apps lookup function to retrieve the first record from a table. To achieve this, we use one or more formulae.
Let's have a look at some examples of how to use the Power Apps lookup function differently.
Example: 1
Consider the below table. The Table name is Marks.
Table Name: Marks
Student Name | English | Maths | Science |
Mary | 65 | 75 | 98 |
Neeraj | 67 | 85 | 56 |
Omar | 75 | 65 | 84 |
Peter | 92 | 55 | 75 |
Qumayun | 75 | 84 | 85 |
Roberts | 52 | 95 | 64 |
Now, we will discuss the different implementations of the lookup function below:
We can apply the lookup function with a single condition in the ‘Marks’ table as follows:
We can identify multiple values in the ‘Marks’ table based on the formula. But this Power Apps lookup function returns only the first record.
The result of this function is Mary.
We can apply this lookup function with multiple conditions in the ‘Marks’ table. For this case, the lookup function is written in the following way.
The conditions or formulae in the Power Apps lookup function can return two records. However, as shown below, the lookup function will return a single output, the first record in the table.
The result for this lookup function is Neeraj.
If we need to get the maximum value of a column from the ‘Marks’ table, we can use the following lookup function.
This lookup function will return a value that is the highest in the ‘Maths’ column of the table.
The result for this function is Roberts.
As you know, the Power Apps lookup function usually returns the first record of any table. But, if you want to get the last record of the table, then you must apply to sort in the result table to return the last record. The logic behind this operation is very simple. We need to reverse the result table so that the last record of the result table comes as the first.
The Power Apps lookup function for this condition is given as follows:
The result of this function is Roberts.
Example: 2
Let’s have a look at one more example to understand how to use the Power Apps lookup function.
Consider the below table:
Table Name: Ice-cream
Flavor | Quantity | OnOrder |
Chocolate | 150 | 80 |
Vanilla | 250 | 60 |
Strawberry | 400 | 0 |
Teaberry | 80 | 120 |
Consider the following lookup function
Consider the below lookup function
This Power Apps lookup function searches for flavors that have a quantity of more than 200. So, the result table will have two records since the ice cream table has two flavors with more than 200. However, the lookup function will return the first record in the table – Vanilla.
The result of this function is 310.
Consider the following lookup function:
This lookup function searches for the ‘Butter Pecan ice cream flavor in the table. The table doesn't have this flavor. It means that there are no records for Butter Pecon in the table. As a result, the lookup function will return a ‘blank’ result.
The output of this function is ‘blank’.
Now, consider the below example.
The result of this function will be as follows:
Vanilla | 250 | 60 |
Example: 3
Are you Still wondering how to catch up with using Power Apps lookup functions? The following example will help you in a great way.
Consider the below example.
Table name: Employee List
Employee Name | Role | Department |
Aliya | Staff | Accounts |
Benjamin | Line Manager | Production |
Chandra | Assistant Manager | Marketing |
Deepak | Associate Manager | Sales |
Eby | Line Manager | Logistics |
If you need the records of the associate manager, then you can write a lookup function as follows:
Employee Name | Role | Department |
Deepak | Associate Manager | Sales |
No reduction formula is included in this lookup function. That’s why the function returned the complete record of the employee.
In the given table, 'Employee name' is the person column. You can use the following lookup operation if you want only the employee name.
The result of this function will be Chandra.
As you know, you can apply multiple conditions or formulae in a Power Apps lookup function. The Power Apps lookup function only returns records that satisfy the conditions.
Consider the below lookup function.
The result of this function will be Eby.
Would you like to ace Power Apps job interviews? Top PowerApps Interview Questions from MindMajix are exclusively for you! |
We can perform multiple operations with Power Apps. Let’s look at how to read as well as set up lookup fields in Dynamics 365.
However, before reading and setting up the lookup field in Power Apps in Dynamics 365, you must perform the below steps.
Once you complete all the above steps one by one, you can view the parent account under the opportunities section.
If you want to assign lookup values to power apps, you need to perform the following steps.
The lookup function in PowerApps returns the first record from a table. It returns the record that satisfies the condition or formula given in the lookup function. Using this lookup function, you can get a single record or a single value. If you need to get a single value, use the reduction formula in the lookup function.
We can use lookup fields in Power Apps in the following way.
You can create a lookup using the Power Apps lookup function. The lookup has three essential elements: table, formula, and reduction formula. You need to create a lookup function based on your desired results.
We can filter lookup fields in Power Apps in the following way.
The columns in tables represent the lookup columns. For example, the table has an employee list, which refers to a lookup column.
In a nutshell, the PowerApps lookup function returns the first row or record of a table. It evaluates the records of the table based on a single condition or number of conditions. If we want to get a single value instead of a record, the lookup function allows doing so. So, this blog might have helped to understand PowerApps lookup concepts, its applications, and many others. If you want to learn more about the PowerApps lookup function, you can visit the MindMajix PowerApps Course and achieve certification. This way, you can sharpen your knowledge better.
Our work-support plans provide precise options as per your project tasks. Whether you are a newbie or an experienced professional seeking assistance in completing project tasks, we are here with the following plans to meet your custom needs:
Name | Dates | |
---|---|---|
PowerApps Training | Nov 23 to Dec 08 | View Details |
PowerApps Training | Nov 26 to Dec 11 | View Details |
PowerApps Training | Nov 30 to Dec 15 | View Details |
PowerApps Training | Dec 03 to Dec 18 | View Details |
Keerthi Sai is a Senior Writer at Mindmajix with tons of content creation experience in the areas of cloud computing, BI, Perl Scripting. She also creates content on Salesforce, Microstrategy, and Cobit.