cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lknudson1
Advocate II
Advocate II

Return to Gallery last selected record

I have a fairly complex Gallery based on SQL query that has variable filters and sort options (below).

When I select a record in the gallery, the program navigates to a detail Form screen for updating information for that gallery record.

Upon return to Gallery, I refresh the data source to reflect changes just added, and after a brief pause, the record I chose is still selected.  So far so good.

 

However, there are 500+ records in the gallery.  When I have had to navigate to a record towards the middle or end of the gallery records (loading additional groups of records to gallery as I go down), I select the record, make changes to detail form as before.  However, when I return to the Gallery, I am returned to some unspecified area of records.  The original selected record is not selected and nowhere in sight.

Is there a way to make sure I return to originally selected record under these circumstances?

 

Thanks for any insight you have.

 

lknudson1_0-1653007187492.png

 

7 REPLIES 7
Drrickryp
Super User
Super User

@lknudson1 

In the OnSuccess property of the form,  capture the edited record in a variable:

Set(vrecord, Self.LastSubmit);Back()

In the gallery set the Default property to vrecord

This throws an error when I try to set default to vrecord:

 

lknudson1_0-1653009956945.png

Sample of Items definition:  Includes lots of conditions for sort and filter conditions, but just basically a record from the query, "v_Job_Task_Source"

 

lknudson1_1-1653010104007.png

 

 

Drrickryp
Super User
Super User

@lknudson1 

In the Default property of the Gallery, Try

Lookup(v_Job_Task_Source, ID=vrecord.ID)

Do you think will that just bring me back to the one record?

And when I first open the gallery how will that be affected?

I will try it and let you know.

Thanks

"bring back to the one record",

like it will only be one item in gallery, vs. showing the one record with all the other gallery items still there?

Drrickryp
Super User
Super User

@lknudson1 

All the items will be there but that one will be selected. 

This works fine if I am toward the beginning of the list.  But if I have scrolled down to later section of the list, return to (gallery page data is refreshed), and the selected job is lost.  Even if I do data source refresh prior to returning to list, it is lost.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,573)