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

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

(0) ShareShare
ReportReport
Posted on by 535 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
    153,049 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

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard