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:
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
andCol = 1
, use the following formula: This will return the value of 10.LookUp(Matrix, Row = 1 && Col = 1, ThisRecord).Value
- Suppose you have a collection called
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:
This will return the price of a compact car running on petrol.LookUp(Cars, CarSize = "Compact" && FuelTaken = "Petrol", Price)
- If you need to find a record that satisfies multiple conditions, you can combine them using logical operators (e.g.,
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: This will give you the display name of the user assigned to task ID 123.LookUp(Tasks, ID = 123, AssignedTo.DisplayName)
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.
Post a Comment