cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
JacksonP
Level: Powered On

Filter gallery through multiple entities

I have three entities in the CDS with the following fields:

-Assessment: AssessmentID (primary key), AssessmentName

-AssessmentQuestions: AssessmentQuestionID (primary key), AssessmentID (lookup to Assessment), QuestionTextID (lookup to QuestionText)

-QuestionText: QuestionTextID (primary key), QuestionText

 

There are two galleries: one for Assessment and QuestionText.

 

What I am trying to do is to have the Assessment gallery display across the top and the QuestionText gallery down the side. As the user selects different options in the Assessment gallery, the questions in the QuestionText gallery will be filtered.

 

I am having trouble figuring out a way to get the QuestionText gallery to filter. The QuestionText gallery does not necessarily need to read directly from the QuestionText entity. I have not as of yet had luck using the AddColumn/LookUp process to get the second gallery (QuestionText) to show the necessary data.

 

Any help or advice? Thanks! 

3 REPLIES 3
TimRohr
Level 10

Re: Filter gallery through multiple entities

Provided you have the Relationships established between your entities, then if the user selects an assessment from the Assessment gallery, the Question gallery should be able to filter its Items. The Data should be set to AssessmentQuestions, and the Items property to:

Filter(AssessmentQuestions,AssessmentID=Assessment_BrowseGallery.Selected.AssessmentID)

Then, on each entry in that gallery, you would have a label to pull in the Question text... this *should* work, but I've had trouble with this formation recently (see the next option for a workaround):

ThisItem.QuestionTextID.QuestionText

If the above doesn't work, use a LookUp() in the Text property of the label:

Lookup(QuestionText, QuestionTextID=ThisItem.QuestionTextID,QuestionText)

If neither of the above options work, make sure you have your Relationships properly defined in CDS.

 

HTH

JacksonP
Level: Powered On

Re: Filter gallery through multiple entities

Hey Tim,

 

Thank you for your help. What you suggested did not work. I am unsure if PowerApps allows filtering based on reference fields in a Canvas App. 

 

I was able to get around the need of filtering using information I found in the below article:

https://powerapps.microsoft.com/en-us/blog/one-to-many-relationships-for-canvas-apps/

 

TimRohr
Level 10

Re: Filter gallery through multiple entities

I'm glad you got something workable, but I thought I would just add:

 

If by "reference fields" you mean the lookup field creating the relationship between your 2 entities, then... yes, you should be able to filter based on that. For instance, if you have many questions associated with one assessment, you should be able to pick the assessment in one part of your app, then filter the Questions datasource to be only where the Assessment field (a lookup to the Assessment entity) is the Assessment you have chosen.

 

If you want to explore it more, post a bit more of your data and we can work it out.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Users Online
Currently online: 319 members 6,297 guests
Please welcome our newest community members: