cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted

Navigate to next filtered gallery item

I've created a gallery based on a filtered collection.  The gallery item references a Variable I've setup in order to filter e.g. 

UpdateContext({FilteredList:Filter(NominationCollection, NominationType = "team" || NominationType = "individual" 
)});

What I now want to do is have someone navigate to the next item in the gallery once they've clicked through to view the item details. This would save them having to go back to the main gallery screen then click on the next item manually.

 

Is there a way to do this? I'm thinking if it somehow gave each item in the gallery a number in order which it appears and then setup a button to load the next item when selected.

 

Thanks.

8 REPLIES 8
Highlighted
Community Support
Community Support

Re: Navigate to next filtered gallery item

Hi @samhegartyunsw1 ,

 

I think this cannot be achieved so far, as the context variable would be different numbers of records according to the filtered result.

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted

Re: Navigate to next filtered gallery item

@v-monli-msft would there be a way when I apply the filter to update a column to give each record a number (starting at 1 then going sequentually) so there's something to reference? Then I could update a button to move to the +1 record?

Highlighted
Super User
Super User

Re: Navigate to next filtered gallery item

I'm not sure if you can adjust this for yours but I have one I do that goes to next item when they click the next button in my gallery. 

 

My gallery is tied to a SharePoint List which uses an auto ID by default.

 

Screen OnVisible = Set(varSelected, 1)

Next button OnSelect= Set(varSelected, ThisItem.ID + 1)

                                  Or = Set(varSelected, varSelected+1) -- If you want them to not have the option to go out of order.

 

Then for what I want to show it has =If(varSelected=ThisItem.ID, true, false)

Highlighted

Re: Navigate to next filtered gallery item

Thanks for the suggestion @rebeccas. In my case, because I'm filtering a collection which means I can't utilise an auto numbering system.

 

I'm really surprised PowerApps hasn't built nextItem and previousItem commands that let you do this as it's a common thing to do.

Highlighted
Super User
Super User

Re: Navigate to next filtered gallery item

If your using a collection instead of a data source you should (in theory...I haven't done this yet) be able to just add a column into your collection and create a auto number in that column. 

 

I usually don't work with collections that aren't tied to a data source but something like this should work for doing the auto number:

 

https://powerusers.microsoft.com/t5/General-Discussion/AutoNumber/td-p/184207

 

Good luck!

Highlighted
Advocate III
Advocate III

Re: Navigate to next filtered gallery item

This example takes the next item from the filtered or sorted gallery which is used for a next button:
PowerAppsNext06.png

Highlighted
Frequent Visitor

Re: Navigate to next filtered gallery item

Hi @jvanrossum /Joost,

 

I saw your blogpost and I would like to say thank you for posting your solution.💪

 

However, I have tried it myself but unfortunately do not succeed, as I run into the following 'issue':  "invalid argument type" within Step 3 at line 6/7 of the code (please see the attached image). 

My SP List is called "Biosurgery" and instead of using a unique product key I am using an ID that I created within the SPlist.

 

Do you have an idea how to fix this? 

 

Thank you and best regards

Jan-Hinrich

 

Powerapps Issue Invalid argument.png

 

 

Highlighted
Frequent Visitor

Re: Navigate to next filtered gallery item

Hi @jvanrossum ,

 

I was able to resolve it myself. Made some mistakes in the syntax.

You are the man for posting this solution. I have been looking for something similar for a long time. So once more, thank you!

 

Best regards

JH

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (10,496)