Canvas Apps Performance

How to optimize Lookup function by not using dot operator

Optimizations

Introduction to the lookup function

The Lookup function is used to find the first record matching a condition. It is one of the most frequently used functions. For a list of all functions in Power Apps, click here.

Lookup function with and without dot operator

Use case: To fetch a column from a record.

Approach 1: Use the dot operator after the Lookup function to fetch the required column from the appropriate record.

Set(
    gblUserTitle1,
    LookUp(
        Users,
        'Primary Email' = User().Email
    ).Title
)

Approach 2: Use comma to specify the column name inside the Lookup function.

Set(
    gblUserTitle,
    LookUp(
        Users,
        'Primary Email' = User().Email,
        Title
    )
)

The problem with approach 1 is that it fetches the entire record first and then the value of the specified column. In approach 2, it only fetches the required column.

Here is an image of the monitor tool showing the difference in times taken for these 2 data calls:

Data calls for with and without the dot operator

As you can see the time span is almost 25% of the time with the dot operator. Please note that the efficiency will vary depending on several different factors like size of the record, number of records in the table etc.

Recent articles

  1. Responsive pop-up using layout containers
  2. Responsive pop-up using traditional containers
  3. How to create a left-aligned responsive gallery

3 thoughts on “How to optimize Lookup function by not using dot operator”

Leave a Reply