web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter gallery by ID o...
Power Apps
Answered

Filter gallery by ID of List

(0) ShareShare
ReportReport
Posted on by 16

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.

Screen Shot 2020-02-04 at 2.03.21 PM.png
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,127 Most Valuable Professional on at

    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.

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    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,

  • Orkido Profile Picture
    16 on at

    @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

  • Verified answer
    Orkido Profile Picture
    16 on at

    @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

     

    Screen Shot 2020-02-05 at 9.47.03 AM.png
    Screen Shot 2020-02-05 at 9.44.17 AM.png
  • cavalcantilins Profile Picture
    31 on at

    Thy this:

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

  • cavalcantilins Profile Picture
    31 on at

    Try this:
    Filter(DocsLib, ID = Int(ID_DataCard1.Text))

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 335 Most Valuable Professional

#2
11manish Profile Picture

11manish 166

#3
sannavajjala87 Profile Picture

sannavajjala87 71 Super User 2026 Season 1

Last 30 days Overall leaderboard