PowerApps lookup

PowerApps has a collection of connectors, services, and applications that work together to ensure users build solid applications and forms. They run on different platforms, and it does not require one to have programming skills. They use cloud services that enable organization users to access and use them anywhere. All the applications depend on logic and workflows to help automate most of the manual business operations. Some platforms you can use include Dynamics365, OneDrive for Business, Salesforce, SharePoint, e.t.c. PowerApps have different functions that help users select different information they want to retrieve from the database(tables). Some of the common functions include lookup, search, and filter. The article will help us understand how the lookup function works and other concepts of lookups that make it helpful to the users.

What is PowerApps Lookup

PowerApps Lookup helps in retrieving different types of information across different data sources. It enables users to select a number of rows from the tables provided. When a user enters a certain search term to find any matching rows or display, the lookup function displays any rows that will match or provide text that has little resemblance according to the query entered. When no content matches the searched query, it usually returns a message letting you know that there are no rows that match your query.

It also gives organizations administrator power to provide several criteria that one can use when looking up values when you use partially typed texts. He can also help users create new rows using the New button option found on the screen. For one to use the button, he must have enough permissions from the administrator for them to perform the action.

When using the lookup feature, most users can view the five most recent rows in a table that the user has accessed recently. The recent users' displays normally depend on their history and favorite rows, which some users pin.

Become a PowerApps Certified professional by learning this HKR PowerApps Training !

Concepts of lookups in PowerApps

There are several ways of enumerating lookups in PowerApps.These ways include the following:

1. Simple Lookup :

It is one of the best lookups since it's simple to implement. You perform it by selecting one single row from a single table that is related.

2. Party-List Type Lookup :

It is usually used for selecting multiple rows from different innumerable tables in the lookup feature. Users use its column to select several columns at the same time. It makes it easy for company users to add rows after completing their new search.

You can perform the same activity several times. When you choose to work with a particular row, you have the power to perform a new search for another row. You have to remember that party-list type lookup does not allow users to customize the system or disable different party-list views for this lookup.

When you filter using getIsPartyList, you get a boolean value to show that it is a party-list lookup. 

It uses the syntax below to find multiple records

formContext.getAttribute(arg).getIsPartyList()

3. Regarding Type Lookup :

It is the last type of lookup. You can use it to select one row from multiple ranges of tables within a lookup. But before using this type of lookup, you have to enable all the activities in a table and set them so that you can use them when working with this lookup.

It uses an advanced lookup feature that was released in the versions of 2021 during the release of wave 2. Wave 2 had a lot of features for the power apps whose main aim was to empower the organizations, individuals, and teams. It improved the usability of applications across all the platforms and provided the ability to publish canvas apps. It also introduced intelligent authoring, which helps in app development.

After enabling the advanced lookup option, you can now find it in the lookup columns, enabling you to create and edit forms or work with the dialog format box faster. You can change the setting and enable it to sort the rows or change the table or views within a lookup column.

You can also control the regarding type lookup customization using the client APIs.For example,you can use the addCustomView to create a new view for the dialog box.It uses the following syntax 

formContext.getControl(arg).addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, isDefault)

The API also provides removePreSearch which users can use to remove functions set for PreSearch event.It use the syntax below

formContext.getControl(arg).removePreSearch(myFunction)

There are several other client API i.e addPreSearch,add custom filter e.t.c.

Most users who use this type of lookup use it for sorting valuable data directories that are normally found within the user's organization or you want to locate essential data within the related tables.

Powerapps Training

  • Master Your Craft
  • Lifetime LMS & Faculty Access
  • 24/7 online expert support
  • Real-world & Project Based Learning

Essentials to perform the lookup function

When working with a lookup function, it uses the following syntax LookUp(Table, Formula, ReductionFormula).

  • Table : It is compulsory and usually acts as the database where it holds all the information when someone performs a search. It handles all the rows.
  • Formula : It represents the formula the user uses to retrieve information in the tables. It usually returns a single record from the table, the first item.
  • Reduction Formula : This type of formula is optional, and one has to specify by providing different information. For example, if one wants the function to return the column value, they will specify the column name. If one does not specify anything he wants, he will always get the first row.

Examples of Lookup functions usage

Let us look at several occasions where one can use the lookup function. The examples include:

  • If you want to use a lookup function that goes through multiple tables using only one condition. The result will provide only the first record and give you the column you want. 
    For example, if you have a table called cars with three columns, namely car size, fuel taken, and price, you want to check the price column. You will use the following formula. LookUp(cars, price > 100000 , Outlook)
  • If you want to get results using multiple conditions. In our example, we will check the price and fuel taken from the cars table using the following formulae. LookUp(cars, price < 100000 && fuel taken > 800, Outlook)
  • If you want to get results without any column, use the formula below, where you get results from any column, and the result will be a single row. LookUp(cars, price = 10000)
  • Another scenario is when you want to get the maximum value. Under the formula, you add the max function inside the lookup function, as shown below. LookUp(cars, price = Max(price), Outlook)
  • The final example is when one wants to get the last record. We use the sort function together with the LookUp function, and it has three arguments where the first argument is the table name, and the second argument is the column you will pick. The last argument will be ascending or descending as shown below: LookUp(Sort(cars, fuel taken, Ascending), price <> 10000, Outlook).

Top 12 frequently asked Powerapps Interview Questions !

Subscribe to our youtube channel to get new updates..!

How to Read and Set Lookup fields of Dynamics 365 in Power Apps

There are several steps one must follow when they want to read or set the lookup field in PowerApps in the field of Dynamics 365. The steps are:

  1. Create your first power app by clicking on the Dynamics 365 tab and selecting Phone layout.
  2. Under the Choose a table, select Opportunities and click the Create option. It will act as our database.
  3. You will get three options on the left side: Browse Screen, Detail Screen, and Edit Screen.
  4. Click on the Browse Screen, which will open several options, click on the Body section, and you will locate the GUID of the parent account display.
  5. We now want to display the parent account name. We click on View, choose Data Sources and click on the Add data source option. You can use the syntax below:

LookUp(Accounts,accountid=MyItem._parentaccountid_value,name)

After this step, you will view the parent's name under the opportunities.

The following steps will now help us with how to assign lookup values to power apps.

  1. On the Edit Screen option, click on it, and under the Data card, insert it in the Accounts tab that has the search icon.
  2. It will list all the accounts that are in the CRM which act as the data source.
  3. Click on the Insert tab, choose the OnSelect option, and use the formula below to show you all the accounts and help you update the account value using the value in DataCardValue11.
    Navigate(AccountScreen,ScreenTransition.Fade,{searchAccountName : DataCardValue11 .Text});Clear(accountToBeAdd)
  4. Repeat the step above and use the formula below to create a new collection name and add it to your chosen account.ClearCollect(accountTobeAdd , {account :BrowseGallery.Selected});Back()
  5. Go to the Insert tab, click on Default and use the formula below to confirm whether the added account has an account id, if it has it will set the name to blank If(IsBlank(First(accountToBeAdded).account.accountid),Blank(),First(accountToBeAdded).account.name)
  6. Click on the Editscreen option, navigate to the Insert tab, choose update and enter the formula below to change the value of the data card on the account the chooser uses.First(accountToBeAdd).account.accountid

Get ahead in your career with our PowerApps Tutorial !

Powerapps Training

Weekday / Weekend Batches

Conclusion

PowerApps has helped many individuals without coding experiences to build and deploy applications that perform several tasks. Knowing and understanding how to use the lookup function gives you more knowledge on how to work with the data sources to enable the proper functioning of the database. The article has enabled you to understand the role of the lookup function when working with PowerApps and how to implement it.

Related Article :

Find our upcoming Powerapps Training Online Classes

  • Batch starts on 1st Dec 2022, Weekday batch

  • Batch starts on 5th Dec 2022, Weekday batch

  • Batch starts on 9th Dec 2022, Fast Track batch

Global Promotional Image
 

Categories

Request for more information

Amani
Amani
Research Analyst
As a content writer at HKR trainings, I deliver content on various technologies. I hold my graduation degree in Information technology. I am passionate about helping people understand technology-related content through my easily digestible content. My writings include Data Science, Machine Learning, Artificial Intelligence, Python, Salesforce, Servicenow and etc.

The lookup helps users find records in a table to display the first record according to the formula they used.

The syntax for the lookup function in PowerApps is LookUp(Table, Formula, ReductionFormula).

A lookup column in PowerApps helps users select rows in related tables.

The lookup field in dynamics helps users define their views that help them display different values according to the entity they belong to.

You can display a lookup field to a canvas app by clicking on the account and clicking on the view under the display form.