cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Filter documents associated via lookups

I have a Document Library, within that library I have a lookup to an Office List.  Multiple Offices can be selected in this lookup.  The lookup uses the Title field from the Offices list.

 

If I have a Gallery that lists the Offices by their title and I select an Office, how can I make another gallery filter the Document Library to the Office selected to only show documents associated to that Office?

 

Thanks for your help!

7 REPLIES 7
WarrenBelz
Super User III
Super User III

Hi @Anonymous ,

Using the list name Office and Title as the lookup field and I will call your galleries Gallery1 and Gallery2

The Items property of Gallery2 would be

Filter(
   Office,
   Title = Gallery1.Selected.Title
)

This would display only the Title records matching that selected in Gallery1 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Anonymous
Not applicable

WarrenBelz thanks for the reply!

 

I'm a little confused.  Your example seems to be filtering offices, not the documents.  So if I have an Offices list and a Bills Document Library.  Here's the code I came up with, but it's still not working.

 

In Gallery2.Items I have "Filter(Bills, [@Offices].Title = Gallery1.Selected)".

 

Now the when I get to the source part of the Filter function, it gives me two options "Offices" and "[@Offices]".  Which one should I use?

 

Thanks!

Hi @Anonymous ,

OK you have a list Offices and a library Bills. The field in Offices is Title and the matching field in Bills is Office ?

Can you please confirm this and give me the name and Items property of the first gallery

Hi @Anonymous ,

 

Since the LookUp column is multi-selection, the Lookup column is actually a nested table with Value and ID Column(from selected Office records), so you can try this, It will filter out all documents that lookup to the selected Office.

 

Filter(Bills,Gallery1.Selected.ID in 'LookUp Column Name'.Id)

 

Note: 'in' operator is not delegable for sharepoint.

Sik

 

Hi @Anonymous ,

@v-siky-msft has given a scenario where the first gallery is based on Bills. Is this the case or is it based on Office - as you have said I have a Gallery that lists the Offices by their title and I select an Office and I have been basing my thoughts in that direction.

I will cover the In operator in the syntax as you have mentioned possible multiple choices of offices and there may be a Collection solution to this depending on the size of your list. The multi-select (complex field type) certainly applies if the list is based on Bills and if so the solution below is correct.

 

Hi @WarrenBelz ,

 

The first gallery is based on Office list, this is certain.

In my understanding, the user selects one record from Office Gallery1, and the Gallery2 displays related Documents from Bill library, (the related records mean lookup column contains the selected Office).

Take an example:

Snipaste_2020-02-26_17-23-01.png

If I select 2 in the left gallery, the right gallery (from F1) will show the related 3 documents records.

Sik

 

WarrenBelz
Super User III
Super User III

Thanks @v-siky-msft ,

I did not manage to turn that corner - mainly because I do not use lookup columns (I do it all in PowerApps).

I was heading in the direction of something like

Filter(Bills,Gallery1.Selected.Company in Company.Value)

if yours works, @Anonymous does not have to look any further.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (79,243)