web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Search/Filter Gallery ...
Power Apps
Suggested Answer

Search/Filter Gallery for Lookup value

(0) ShareShare
ReportReport
Posted on by 25
 
Hi guys,
 
I'm currently building a PowerApp in the Dataverse of Dynamics365. 
I have a gallery which displays the contact entity. A contact can be connected to a company. The users now request to also search for the company.
 
To display the Company Name in the gallery I do a lookup over the ERP Number:  
 
LookUp(Companies, 'ERP Company Number' = ThisItem.'ERP Company Number').'Company Name'
 
Now I want to adjust the items function of the gallery, that I can search also for the company name.
 
Items currently looks like this:
 
Search([@Contacts], SearchInput1.Text, 'Full Name', 'E-Mail Adress')
 
And I tried doing it like this:
 
Search([@Contacts], SearchInput1.Text, 'Full Name', 'E-Mail Adress',LookUp(Companies, 'ERP Company Number' = ThisItem.'ERP Company Number').'Company Name')
  
Does anyone have an idea how I could solve this?
 
 
Thanks in advance :)
Categories:
I have the same question (0)
  • Suggested answer
    Gabriel G. Profile Picture
    831 Super User 2025 Season 2 on at
    Hi!

    To be able to search in a column, it needs to be a text. To do this, you can simply add a column with the wanted value as a text. In your case:
     
    Search(AddColumns([@Contacts]; cpyName; 'ERP Company Number'.'Company Name'), SearchInput1.Text, 'Full Name', 'E-Mail Adress', cpyName)
     
    I hope it helps!
    ________________________________________________
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
  • NandiniBhagya20 Profile Picture
    4,667 Super User 2024 Season 1 on at
     
     
    You have to add column to Contacts table to use search functionality. Try using something like below:
    Search(AddColumns([@Contacts],NewCompanyName,LookUp(Companies, 'ERP Company Number' = 'ERP Company Number').'Company Name'), SearchInput1.Text, 'Full Name', 'E-Mail Adress',NewCompanyName)
  • MH-09121531-0 Profile Picture
    25 on at
    @Gabgadou, @NandiniBhagya20, thanks for the answer.

    I also tried this already, but somehow it doesn't work for me. When I want to use the AddColumn function it somehow doesn't work. 
     
    The thing is, in Contact and Companies Table there are multiple million records. Aren't theses way to many records to work with, in a collection?
     
    And then there is the problem, that the 'ERP Number' Field in the Contact is labeled equally to the one on companies. So how can I make sure, to compare the ERP Number of the Company with the ERP Number of the Contact? In the Lookup for the Label Company Name I could use ThisItem to be sure, but in this case I can't use this.
  • NandiniBhagya20 Profile Picture
    4,667 Super User 2024 Season 1 on at
    Hey,
     
    I used the below formula, and it worked for me. I have added a new column to Expenses table, NewName that I am fetching from Contacts table by comparing Department.
    Search(AddColumns(Expenses As TP,NewName,LookUp(Contacts,Department=TP.Department).'Full Name'),"A",NewName)

    I have used alias for expenses table just to differentiate between the tables as the column names are similar.
  • Gabriel G. Profile Picture
    831 Super User 2025 Season 2 on at
    Well, I’m really surprise you can’t achieve a AddColumns function there.
     
    About the amount of records, for sure you can’t deal with that much records at once in your app.  But you can pre filter the data, paginate your gallery and more to make sure you don’t exceed maximum capacity on your application.
     
    For the problem about 2 fields with the same name, you can use logic name instead of viewing name. There is not always intellisense on the use of logic name through canvas app, but just type the logic name and it should not give you an error, which mean it finds the reference.
     
     Cheers!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard