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

using Filter in Gallery

Hello, I'm trying to use lookup and filter but not sure how to go about this, 

Currently I have two CDS: 

    1-   L5QuestionList {L5QuestionNumber,Heading}

    2-   QuestionHeading {HeadingID, HeadingDescription}

Capture.PNGCapture1.PNG

In PowerApps, currently I have a Gallery that display items = QuestionHeadings
headingG.PNG

 

Question: How do I filter the gallery to only display a certain heading? 
**I want it to lookup from Source L5QuestionList and only display HeadingDescription from source QuestionHeading if L5QuestionList.Heading = QuestionHeading.heading  (so that if there is no question under a heading it won't be display)

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: using Filter in Gallery

@WaMCHCH 

Here's a nice one-liner solution to your question.  Put this code in the Items property of your gallery for QuestionHeading.

 

Filter(QuestionHeading,HeadingID in L5QuestionList[@Heading])

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

View solution in original post

4 REPLIES 4
Super User
Super User

Re: using Filter in Gallery

@WaMCHCH 

Here's a nice one-liner solution to your question.  Put this code in the Items property of your gallery for QuestionHeading.

 

Filter(QuestionHeading,HeadingID in L5QuestionList[@Heading])

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

View solution in original post

WaMCHCH
Frequent Visitor

Re: using Filter in Gallery

Hi, @mdevaney  thank you for your reply, I have tried your code but i got error:

 

Filter(QuestionHeading,HeadingID in L5QuestionList[@Heading])

it doesn't recognize L5QuestionList  data source, so I got an error saying: "The specified  column is not accessible in this context"

 

Super User
Super User

Re: using Filter in Gallery

@WaMCHCH

I tested the solution using by making a collection where Heading was a string type column and it worked.  The reason it does not work you must be that Heading is a different column type such as a complex column.  I'm not sure what to do next here...

WaMCHCH
Frequent Visitor

Re: using Filter in Gallery

@mdevaney thank you

 

in the two CDS i have QuestionHeading with HeadingID as primary key

and in QuestionList I have a Heading which is a lookup from QuestionHeading  
I'm not very familiar with collection, I will try and look at some example and try to approach filtering with collection instead...

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (6,968)