cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Strahlemann
Frequent Visitor

How to search effectively with lookups to referenced entities.

I'm trying to get a search done in power apps that would also include results from referenced lookup tables.

Unfortunately I'm not able to figure out a solution that works to my expectations.

Searching from "TextInput_ProjectFilter.Text", within the DB Opportunities, for the Columns "_ownerid_value" and "_od4u_endcustomer_value" returns the GUIDs and I need to do a lookup to another entity to receive User readable text values.

Original Query that runs if a Filter is applied:

If(Not(TextInput_ProjectFilter.Text = ""),Search(Opportunities,TextInput_ProjectFilter.Text,"_ownerid_value","_od4u_endcustomer_value","od4u_location","new_opportunityid","od4u_endcustomercountry","od4u_projecttitle","name"))

On the web, I found a solution that uses the AddColumns Function. This approach works but is very slow and it takes about 3 Minutes to receive the results:

If(Not(TextInput_ProjectFilter.Text = ""),Search(AddColumns(Opportunities,"lookup_endcustomer_value",LookUp(Accounts, accountid = _od4u_endcustomer_value),"lookup_ownerid_value",LookUp(Users, systemuserid = _ownerid_value),"add_od4u_location",od4u_location,"add_new_opportunityid",new_opportunityid,"add_od4u_endcustomercountry",od4u_endcustomercountry,"add_name",name),TextInput_ProjectFilter.Text,"_od4u_endcustomer_value","_ownerid_value","add_od4u_location","add_new_opportunityid","add_name"))

Would anyone have a hint how to make a better - e.g. faster approach for the search?
1 ACCEPTED SOLUTION

Accepted Solutions
Meneghino
Community Champion
Community Champion
2 REPLIES 2
v-yamao-msft
Community Support
Community Support

Hi Strahlemann,

 

How many data are there in your data source?


You could consider to combine Filter function within in your code, filter the data you need first then search from the filtered data, I assume that it will return results more efficiently.


Hope this documentation could be a reference for you:
https://powerapps.microsoft.com/en-us/tutorials/delegation-overview/

 

Please try it on your side to see if it will work for you.

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Meneghino
Community Champion
Community Champion

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (4,000)