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 / Autoselect on gallery
Power Apps
Unanswered

Autoselect on gallery

(0) ShareShare
ReportReport
Posted on by 49

Hi, 

 

I have a PowerApp where in the left side there are two galleries. Gallery1 displays an item name, and Gallery2 displays cases related to the item selected in Gallery1. So one gallery filtering the other gallery. On the right side of the screen there is a form displaying the case selected in Gallery2. 

 

Everything works. But I have a problem, since Gallery2 does not automatically select the top item in the gallery. Sometimes there is only one case available in relation to the particular item selected in Gallery1, but it is not autoselected. It would save a lot of clicks if Gallery2 always selected the top item. 

 

Is there anyway to do that? 

 

I have tried to make the default in Gallery2 the top item by setting the default to this: First('database'.CaseNum) , but it appears not to work. The database is the items of Gallery2, and the CaseNum is where I would like the first case to be selected. 

 

I have attached a picture, where you can see that something is selected in Gallery1 but nothing is autoselected in Gallery2. 

Screenshot.png
Categories:
  • mdevaney Profile Picture
    29,993 Moderator on at

    @C-Jac 

     

    Try this code in the Item property of your form.

     

    If(IsEmpty(Gallery2.Selected)=true,First(Gallery2.AllItems),Gallery2.Selected)

    ---

    Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly.  If your thought the post was helpful please give it a "Thumbs Up."

     

     

     

  • C-Jac Profile Picture
    49 on at

    It is just returning 'No item to display' 😞

  • mdevaney Profile Picture
    29,993 Moderator on at
    Did you link the form to a datasource? What fields does the form contain in Edit Fields? What mode is your form being displayed in (New/Edit/View)?
  • v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @C-Jac ,

     

    If there is only one item in gallery, it will be auto- selected, but not when there are more than one items.

    So you can try the following formulas on items property of Form:

     

    If(CountRows(Gallery2.AllItems)>0,First(Gallery2.AllItems),Gallery2.Selected)

     

    Annotation 2019-09-23 111434.png

    Although this work around doesn't make the auto-selection of gallery done, the form will always show the first item.

    Hopefully this can help you.

     

    Best regards,

    Sik

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 232 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 202 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard