cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AdamH
Post Patron
Post Patron

Filtering a record based on a choice value

Hi All,

 

I have been looking into creating a filter based on a lookup value within a SP List record. 

I have a staff database app. Any member of staff can be a mentor to another member of staff.

 

For example:

Joe is a student

Sam is Joe's mentor. In Joe's record, Sam is listed as his mentor. 

Sam also mentors Fred, and in Fred's record, Sam is listed as his mentor.

 

I want to be able to go into Sam's record and see a list student names who he mentors. But at the same time, I want to be able to go into any staff record and see if they are mentoring any students. 

 

The data fields are as follows:

'Employee Name' - Single Line of Text

'Mentor / Preceptor' - Lookup field (allowing multiple values) pointing to the 'Employee Name' Column. 

 

Thanks 

Adam

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @AdamH ,

 

I did a test for you.

1\ This is my list 'LIST127'.

v-xiaochen-msft_0-1622083894274.png

 

2\ Add a gallery control 'Gallery1' and set its Items property to:

LIST127

 

3\ Add a combo box control and set its Items property to:

LookUp(LIST127,'Employee Name'=Gallery1.Selected.'Employee Name').'Mentor / Preceptor'

 

4\ Add a combo box control and set its Items property to:

Filter(ForAll(LIST127,If(Gallery1.Selected.'Employee Name' in ThisRecord.'Mentor / Preceptor'.Value,ThisRecord,Blank())),!IsBlank(Title))

 

5\ Now if I select the 2nd Item 'BBB' in my gallery ,the result is as follows:

v-xiaochen-msft_1-1622084076221.png

// BBB's mentor

v-xiaochen-msft_2-1622084087138.png

// BBB's mentee

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

 

 

 

View solution in original post

4 REPLIES 4
v-xiaochen-msft
Community Support
Community Support

Hi @AdamH ,

 

I did a test for you.

1\ This is my list 'LIST127'.

v-xiaochen-msft_0-1622083894274.png

 

2\ Add a gallery control 'Gallery1' and set its Items property to:

LIST127

 

3\ Add a combo box control and set its Items property to:

LookUp(LIST127,'Employee Name'=Gallery1.Selected.'Employee Name').'Mentor / Preceptor'

 

4\ Add a combo box control and set its Items property to:

Filter(ForAll(LIST127,If(Gallery1.Selected.'Employee Name' in ThisRecord.'Mentor / Preceptor'.Value,ThisRecord,Blank())),!IsBlank(Title))

 

5\ Now if I select the 2nd Item 'BBB' in my gallery ,the result is as follows:

v-xiaochen-msft_1-1622084076221.png

// BBB's mentor

v-xiaochen-msft_2-1622084087138.png

// BBB's mentee

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

 

 

 

@v-xiaochen-msft 

 

Thanks for your reply. I see how you have put that together, But I want to be able to open the existing mentor record and see the filtered students from within the record. 

 

Example, 

BrowseScreen1 (open a record) > DetailScreen1 (within this screen I will see if this member of staff mentors anyone)

 

AdamH
Post Patron
Post Patron

@v-xiaochen-msft 

 

I took what you posted and change it a little:

 

Inserted a list box control

Items Property: 

Filter(ForAll(LIST127,If(Gallery1.Selected.'Employee Name' in ThisRecord.'Mentor / Preceptor'.Value,ThisRecord,Blank())),!IsBlank(Title))

Value: 'Employee Name'

 

Thanks for your help!

@v-xiaochen-msft 

 

I found a little problem, If I have two galleries that navigate to the DetailScreen1 where I have inserted the ListBox control:

BrowseGallery1

Gallery2

 

How would I code this, at the moment, when I navigate from Gallery2 to DetailScreen1 It does not show the correct student records for that mentor

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,802)