cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Orkido
Level: Power Up

Filter gallery by ID of List

Hi guys,

I'm new to power Apps and here is what I have:

A list: ListLookup1

A Document Library: DocsLib (tie to the list by ID)

A Power Apps Form: SharePointForm1 (Data source is the list)

A gallery: Gallery1 (Data source is the document library)

I'm trying to sort the gallery depending on the ID displayed on the form.

Here is what I tried with no success so far:

Filter(DocLib,"File:ID" = ID_DataCard1.Datafield)

Thanks for your help.

1 ACCEPTED SOLUTION

Accepted Solutions
Orkido
Level: Power Up

Re: Filter gallery by ID of List

@v-xida-msft , Thank you for your suggestions

The File:ID is a lookup column from my list.

I followed your suggestions. They didn't work but they allowed me to realized the problem was in fact the datatype of my ID column. I switched to another column and that worked.

Thanks so much!!! 

Orkido

 

View solution in original post

4 REPLIES 4
WarrenBelz
Level 8

Re: Filter gallery by ID of List

Hi @Orkido ,
Firstly, to sort a list is 

 

Sort(
   <Data Source>,
   <Field to be sorted on>,
   Ascending/Descending
)

 

Ok just so I have this right, you have a gallery of documents tied to a SharePoint list with the SharePoint ID as the joining key fields. The Items of the Gallery is 

 

Filter(
   DocLib,
   "File:ID" = ID_DataCard1.Datafield
)

 

and produces a list of matching documents, which you now want to sort. These will only have one ID, so I am assuming you want to sort on another field in the gallery so

 

Sort
   Filter(
      DocLib,
      "File:ID" = ID_DataCard1.Datafield
   ),
   <Field to be sorted on>,
   Ascending <or> Descending
)
   

 

Is this what you are asking?

 

If this post helps, then please consider Accept it as the solution to help the other members find it more. It also closes the item.

Community Support Team
Community Support Team

Re: Filter gallery by ID of List

Hi @Orkido ,

Could you please share a screenshot about the data structure of your SP Library?

Which column do you use in your SP Library to bind to the Item ID in your SP List? Is the "File:ID" column?

 

Based on the formula that you mentioned, I think there is something wrong with it. I assume that there is a LookUp type column called "ListItemID" existed in your SP Library, which is used to reference values from the List Item ID values from your SP List.

 

On your side, please consider set the Items property of the Gallery to following:

Filter(
       DocLib, 
       ListItemID.Value = Value(ID_DataCard1.Default)
)

 

If the "ListItemID" column is a Number type column, please consider modify above formula as below:

Filter(
       DocLib, 
       ListItemID = Value(ID_DataCard1.Default)
)

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Orkido
Level: Power Up

Re: Filter gallery by ID of List

@WarrenBelz , Unfortunately I'm not at the sorting step yet.

The code for displaying items in the gallery based on the value of a DataCard in the form isn't working.

I tried this:

     Filter(DocLib,"File:ID" = ID_DataCard1.Datafield)

Then this:

     Filter(DocsLib, 'File:ID'.Value = Value(ID_DataCard1.Default)

     Error: Invalid argument type

Then this:

    Filter(DocsLib, 'File:ID'.Value = Value(ID_DataCard1.Default)

    Warning: Incompatible type

Orkido
Level: Power Up

Re: Filter gallery by ID of List

@v-xida-msft , Thank you for your suggestions

The File:ID is a lookup column from my list.

I followed your suggestions. They didn't work but they allowed me to realized the problem was in fact the datatype of my ID column. I switched to another column and that worked.

Thanks so much!!! 

Orkido

 

View solution in original post

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,556)