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

Community site session details

Session Id :
Power Apps - Building Power Apps
Suggested answer

Gallery Default Item

(0) ShareShare
ReportReport
Posted on by 73
Hi I am finding it impossible to set the default item in a gallery to a specific item ID. The data source is a sharepoint document library. I have tried for example:
 
Filter('Shared Documents',ID = 451))
 
But this does not work, any ideas how I do this?
 
Thanks
 
 
Categories:
I have the same question (0)
  • Suggested answer
    SaiRT14 Profile Picture
    1,988 Super User 2025 Season 2 on at
    Gallery Default Item
    pls try the following:
     
    Filter for Specific ID: First(Filter('Shared Documents', ID = 451))
    Create a context variable for the default item: Set(DefaultItem, First(Filter('Shared Documents', ID = 451)));
    Bind the variable to the gallery’s Default or DefaultSelectedItems property: DefaultItem
     
    let me know if you need more details
  • WalesMariner Profile Picture
    73 on at
    Gallery Default Item
    @SaiRT14 Do I set the context variable in the OnVisible property of the Screen, this is where I've tried it but its not working?
     
    Thanks
     
     
  • ronaldwalcott Profile Picture
    3,827 Super User 2025 Season 2 on at
    Gallery Default Item
    Please provide more details on what you are trying to accomplish.
    Filter will select records but what do you want to do with those records?
  • WalesMariner Profile Picture
    73 on at
    Gallery Default Item
    @ronaldwalcott This is what I am trying to accomplish:
     
    I have a form and a gallery on the same screen. The form is linked to a SharePoint List. The gallery is linked to a SharePoint Document Library. 
     
    The SharePoint List has lots of fields but the two relevant here are the 'Title' column and the 'DocID' column. Both of these appear as fields on the powerapp form.  
     
    When the form is in FormMode.New I am using the gallery to select from all the documents within Shared Documents, and with that selection, populate the forms Title field with the documents 'Name' and the forms DocID field with that document 'ID'.  When I hit the submit button this adds a new item to my SharePoint list (there are other unrelated bit of information that also go in other columns). This is working fine.
     
    When the form is in FormMode.Edit I need the Gallery to automatically select the document from all the documents within the Shared Document library that has the same ID (as was stored in DocID column of the SharePoint List) or the same Name (as stored in the title column of that list)
     
    In the example above I was just trying to filter to ID = 451 to see if I could actually return an item within the Gallery, really, I want to by able to dynamically match to the item being edited e.g. 

    Name = DataCardValue6.Text  or (DataCardValue6 being the Text entry field for that datacard)
    ID = Value(DataCardValue8.Text (DataCardValue8 being the Number entry field for that datacard)
     
    Hopefully that makes sense!
     
     
     
     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 663 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 398 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 235

Last 30 days Overall leaderboard