cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mssss
Helper V
Helper V

How to Filter lookup field CDS

I think this is not that difficult but I am having trouble filtering my gallery.

 

My data all is CDS.

I would like to filter my gallery like the following.

 

I’ve tried this but not working.

Filter(tabelname, TextSearchBox1.Text in  fieldname(lookup).'name')
Filter(tabelname, TextSearchBox1.Text in  table_b.'name')
 
'name' is a field in Related table(tabelname: table_b)
 
Any help is appreciated!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Actually my bad, Please forgive me.

You can't filter a field from a related table, what you need to do and to minimize the lookup calls is :

  1. Collect your table1 in a collection like so (ClearCollect, varTable1, table1);
  2. Collect table2 (related table) : ClearClollect(varTable2,table2);
  3. ClearCollect(varFinalTable,AddColumns(varTable1,"Name", LookUp(varTable2,name = varTable1[@fieldname(lookup)]).Name));
  4. For  the gallery Items you use (Filter(varFinalTable,IsMatch(Name,TextSearchBox1.Text))

You need to understand delegation, and work your way to update your rows or create elements in database (using Patch etc ).

 

Regards,

------------------------------------------------------------------------------

If this helped you, please consider giving it kudos and accept it as a solution. Thanks 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hello @mssss ,

 

Try doing something like

Filter(tabelname,IsMatch(fieldname(lookup).'name',TextSearchBox1.Text))
 
Regards,

------------------------------------------------------------------------------

If this helped you, please consider giving it kudos and accept it as a solution. Thanks 

 

@Anonymous 

 

thank you for your help!

I am still having errors. 

Would you please check this?

I've tried two way.

 

mssss_1-1608891423994.png

 

 

Anonymous
Not applicable

Actually my bad, Please forgive me.

You can't filter a field from a related table, what you need to do and to minimize the lookup calls is :

  1. Collect your table1 in a collection like so (ClearCollect, varTable1, table1);
  2. Collect table2 (related table) : ClearClollect(varTable2,table2);
  3. ClearCollect(varFinalTable,AddColumns(varTable1,"Name", LookUp(varTable2,name = varTable1[@fieldname(lookup)]).Name));
  4. For  the gallery Items you use (Filter(varFinalTable,IsMatch(Name,TextSearchBox1.Text))

You need to understand delegation, and work your way to update your rows or create elements in database (using Patch etc ).

 

Regards,

------------------------------------------------------------------------------

If this helped you, please consider giving it kudos and accept it as a solution. Thanks 

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (2,161)