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

Get Next Item in Gallery - move from one record to another (DB)

Hello fellow PowerApps users! 

Smiley Very Happy

I have a question:

 

I have created two screens. The first screen involves a gallery which is linked to and navigates to screen two. Screen two contains certain data for each gallery item. the data is stored on a Microsoft Azure SQL Server. Is it possible to create a button on screen two to get the next gallery item? (back-end: jump to next record in the SQL Server). I have searched for a while, but only found posts saying this is not a feature yet (2017). Does anyone know if there was made a feature-request? Smiley Happy

 

Best regards, 

Silje 

3 REPLIES 3
Highlighted
Anonymous
Not applicable

Re: Get Next Item in Gallery - move from one record to another (DB)

I hope you maintain a collection which stores data from Azure SQL DB. If so, try this option on Second screen

 

1. On visible declare  

UpdateContext({ROWNUM: 1}) // This can be the selected record number from Screen 1

 

2. On select of "Next" Button (to get next gallery item)

UpdateContext({ROWNUM: ROWNUM + 1}) // Move to next record 

Use Lookup(collection, ROWNUM = ThisItem.ROWNUM, <RETURN FIELD>) // This will get you next record

 

Note: As you are using Azure SQL DB Please refer to generate ROW_NUMBER(), this way you can get a sequence of unique number in you records. Also note that the ROW_NUMBER need not be starting from 1 in your scenario.  Just pass the first ROWNUM from screen 1.

Highlighted
Advocate III
Advocate III

Re: Get Next Item in Gallery - move from one record to another (DB)

here is an example on how to go to the next (or previous) record in a gallery to use it for a next/prev button:

https://microsoft-bitools.blogspot.com/2020/03/power-apps-get-next-item-from-gallery.html 

 

PowerAppsNext05.gif

Highlighted
Frequent Visitor

Re: Get Next Item in Gallery - move from one record to another (DB)

Hi @jvanrossum,

 

I have one more question.

Your solution technically works on my end. The only trouble I have is the following:

 

This is my set up:

1. I have a browsing page that displays in a gallery all items of a linked SP list. Once you click on the item you are taken to an

2. edit-page, where you can alter the items specific content and save it. Once the item is saved, I want the user to hit the

3. next-button to move over to the next gallery item.

 

And now the trouble starts: Whereas the first saving process(PATCH-function) works just fine, I cannot achieve saving the altered specifics of the next item back to the SP list. I therefore tried the Reset()-function OnSelect of the next button, but that lead to an error stating the Reset function can't be used as such.

Do you have an idea how to achieve a proper flick-through with saving back option?

 

 

Thank you for your support.

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 (6,249)