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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How do I get a form to...
Power Apps
Unanswered

How do I get a form to populate with the first item in a gallery when a filter is applied to the gallery?

(0) ShareShare
ReportReport
Posted on by 831 Moderator

I have a gallery that updates a form with the gallery item selected. Now, when I am on the screen and use a filter on the gallery the form blanks. I would like it to auto select the first gallery item. 

 

I'm not sure of this is related but if I navigate off the screen and then come back the last gallery item I viewed is still in the form instead of resetting. In this case I would also like to select the first item in the gallery.

 

One thing I did notice. If I choose the most recent record from and of the filters the form will populate. It won't do it for any older records(gallery items) unless I click on the item in the gallery.

 

Hope this is not confusing

Categories:
I have the same question (0)
  • Ethan_009 Profile Picture
    4,838 Moderator on at

    Hi @futr_vision ,

     

    You can create a variable and use it on the Form.

    //For getting 1st record use
    
    First(Gallery1.AllItems)

     

    You can use this to your variable or Form. 

    Note: You need to define you variable every time but direct reference can become unstable as if context is gone from other screen, your data may go blank or value may change based on filters. So, try keeping that constant with a variable else you select 1 record and then it changes the record and you will update other record.

     

    Hope this helps 

  • futr_vision Profile Picture
    831 Moderator on at

    Hmm. Interesting. It does select the first item in the gallery. Problem is when I select any other item in the gallery the form only shows the first item. I need to be able to select gallery items and at the same time default to the first item is none are selected. Sounds like I need to build out some logic

  • futr_vision Profile Picture
    831 Moderator on at

    @Ethan_R 

    I failed to read the continuation of your answer before responding. So let me see if I understand how to implement this.

    1. When the screen loads I should set a context variable to First(Gallery1.AllItems)
    2. When I select another record from the gallery I need to set the form to the selected item?
    3. When a filter is applied, I need to reset the variable and set it to First(Gallery1.AllItems)?

    Something like this?

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard