PowerApps: LookUp function examples

Let’s dive into some examples of using the PowerApps Lookup function. This function is handy for finding specific records in a table based on certain criteria. Here are a few scenarios:

  1. Single Condition Lookup:

    • Suppose you have a collection called Matrix with rows representing different cells (e.g., Row 1, Column 1, Value 10).
    • To retrieve the value from the cell where Row = 1 and Col = 1, use the following formula:
      LookUp(Matrix, Row = 1 && Col = 1, ThisRecord).Value
      
      This will return the value of 10.
  2. Lookup with Multiple Conditions:

    • If you need to find a record that satisfies multiple conditions, you can combine them using logical operators (e.g., && for AND, || for OR).
    • For instance, to find a specific car’s price from a table with columns like “Car Size,” “Fuel Taken,” and “Price,” you can use:
      LookUp(Cars, CarSize = "Compact" && FuelTaken = "Petrol", Price)
      
      This will return the price of a compact car running on petrol.
  3. Lookup with Lookup Columns or Person Columns:

    • When dealing with lookup columns (e.g., linking to other tables) or person columns (for user names), the Lookup function remains useful.
    • For example, if you have a lookup column called AssignedTo in a task list, you can retrieve the assigned user’s name:
      LookUp(Tasks, ID = 123, AssignedTo.DisplayName)
      
      This will give you the display name of the user assigned to task ID 123.

Remember that the Lookup function helps you find the first record that matches your criteria. Whether it’s a single condition or multiple conditions, it’s a powerful tool for data retrieval in PowerApps.

No comments

Powered by Blogger.