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

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
Highlighted
Solution Sage
Solution Sage

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

Highlighted
Frequent Visitor

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/

 

Highlighted
Solution Sage
Solution Sage

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
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (8,512)