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 / Navigating to the prev...
Power Apps
Answered

Navigating to the previous and next items in a filtered gallery

(0) ShareShare
ReportReport
Posted on by 24

Hi,

I have a 2-screen app:

-  Screen 1 allows to filter gallery items pulled from a sharepoint document list, each item links (navigate) to screen 2

- Screen 2 provides more details about all the field related to the selected item in screen 1 (using a form that points to the selected item, as LookUp(sharepointDataSource,ID=screen1Gallery.Selected.ID)

 

I'd like my users to stay on screen 2 and be able to navigate to the previous (left icon) or next (right icon) in the filtered gallery (i.e., not the original sharepoint list) without having to navigate back to screen 1.

I'm struggling to reference to the previous and next items in the filtered gallery, obviously ID's are not selected.ID +/- 1, it all depends on the filters.

 

Any pointers?

Thanks in advance,

CBO

Categories:
I have the same question (0)
  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    @CBO29 you would need to get the Index of the selected record.
    A possible way to do this is to create an indexed collection of the gallery in the OnVisible of the second screen.

    ID

    Index
    251
    322


    This thread explains how you could create such an index collection.

    Clicking on next would have the following code:

     

    Select(GalleryName, LookUp(colIndexedGallery, GalleryName.Selected.ID = ID).Index + 1)

     


    This will change the GalleryName.Selected values.

    I hope this helps!

  • Verified answer
    CBO29 Profile Picture
    24 on at

    Hi LaurensM,

    many thanks for the 2 tips, that put me in the right direction. I'll outline the required modifications in case someone/you suggests something simpler:

     

    Regarding 

    Select(GalleryName, LookUp(colIndexedGallery, GalleryName.Selected.ID = ID).Index + 1)

    - I got an error "Select of a control that is not on this screen (Gallery was defined on screen 1, next icon is on screen 2")

    - It would work but with only one selection of the next button, as the lookup keeps referring to the Selected ID from screen 1

     

    Small modifications to get it work

    - defined 2 variables 2 keep track of current selected ID and corresponding index, the onSelect of the next or Previous icon would update them

    - for the good looks of the page, made the next or previous icon not visible based on where the current index stood vs min index (1 by design), max index (that has to be captured upon  creating the collection when screen 2 becomes OnVisible.

     

    Thanks a lot

    CBO29

  • LaurensM Profile Picture
    12,516 Moderator on at

    @CBO29, glad I could be of help.

    Would it be possible to accept both answers as solutions, since they are intertwined?
    This will close the item and help other community members who have the same issue.

    Thanks!

  • CBO29 Profile Picture
    24 on at

    Hi,

    I can certainly do it, because it really unlocked the situation for me... hopefully other community members will read down.

    Best

  • KN4 Profile Picture
    2 on at

    Hi @CBO29 I am struggling with exact same scenario, could you elaborate how you were able to achieve this? especially with getting the index created. Many thanks !

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard