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 / Selecting a Gallery Re...
Power Apps
Answered

Selecting a Gallery Record AND Displaying the item's data in a view form on app start

(0) ShareShare
ReportReport
Posted on by 546 Super User 2024 Season 1

I have a single page app that has a gallery on it and a view form.

 

I'm trying to get the first record of the gallery selected when the app loads AND have the View Form show that record's data.  

The Gallery's OnSelect is 

 

Set(varThisCase,LookUp('Test List',Title=ThisItem.Title))

 

(Title is my unique field)

 

The ViewForm's item property is varThisCase

In the screen's OnVisible, All that's in there is Select(Gallery1,1).  

 

Here's what's happening:

 

When the app starts, I get an error that says "Row or column passed to the Select function is outside the bounds of the gallery items"

 

If I ignore the error and select a record in the gallery, it shows me the record in the Viewform.

 

I put in an additional test page with 1 button on it that clears the varThisCase variable and Navigates back to the main page.  When that navigation happens, I don't get that same issue with the Row or column passed being outside the bounds of the gallery items, the first record gets selected (as expected) and the record is shown in the viewform.

 

It appears that the gallery bounds issue only happens when the app is first launched.

 

What possible workarounds do I have here to:

  1. Select the first record in the gallery on app start
  2. Show the record's information in the View Form (again, on app start)

I've looked at several different ways of selecting that first record (including setting the Gallery's Default to First(Gallery1.AllItems).  Nothing seems to work.  😞

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    154,787 Most Valuable Professional on at

    Hi @zuurg ,

    You were close to the idea in your last statement. You did not post what the Items of the gallery or your data source, however you can do this at AppOnStart or Screen (Gallery) OnVisible using the full code of your Gallery Items

    Set(
     varThisCase,
     First(
     YourGalleryItemsHere
     )
    )

    Then the Default of the Gallery

    varThisCase

    Your Form is already set correctly.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 519 Most Valuable Professional

#2
11manish Profile Picture

11manish 489

#3
Haque Profile Picture

Haque 327

Last 30 days Overall leaderboard