cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Piliglish
Level: Power Up

navigate to next item

Hi,

I am trying to add a button to a Powerapps ap that will take the viewer to the next item in the list.

I have built an app using a sharepoint list and there are 190 items in the list.

When I run the app I can see the first item, but I now want to be able to see all of the items by using a button that will not only take me to the next item but another button that will take me back to the beginning.

As this is a standard button in all databases I am amazed that this appears to be impossible within Powerapps.

Any help, please.

I have tried to use the update function to ID+1 on the select function of the button, but this does not work.

Peter

2 ACCEPTED SOLUTIONS

Accepted Solutions
ChrisR
Level 8

Re: navigate to next item

Taking a guess at what you’re asking, so I'll assume you have a form that displays an initial record, the 1st record by ID.  You want a button that will make your form display the next record by sequential ID.

As @CMee pointed out, deleting a record would cause an issue with just doing an ID+1.

 

Not being entirely sure of your situation, but I’ll take a shot:

OnStart or OnVisible or however you want to set the initial record ID:

Set(varID,First(DataSource).ID)

 

In the Forms Item Property:

LookUp(DataSource,ID = varID)

 

In the “Next” button’s onselect property:

Set(varID,First(Filter(DataSource,ID > varID)).ID)

 

In the “Start Over” button’s OnSelect property:

Set(varID,First(DataSource).ID)

 

 

Above is a direct way but not the most efficient way and it's not delegable. I personally would load the SP list in a collection first, but since I’m not entirely sure what you're doing I'll just keep it simple.

 

Hope it's what you are loking for,

Chris

 

 

PowerApps Training

Piliglish
Level: Power Up

Re: navigate to next item

Hi Chris

 

Perfect !!

 

This is exactly what I have been looking for and you are the first person who has provided me with the way to achieve exactly what I was looking for.

 

I have spoken to over 6 different Microsoft Support technicians, including 3 screen views and not one of them was able to help.

 

Thank you very much

 

Peter

6 REPLIES 6
CMee
Level: Powered On

Re: navigate to next item

A couple of questions,

 

  1. Are items often deleted from your SP list? If so then ID+1 will not work as the next item might not have an ID = ID+1.
  2. Which update function are you referring to? I'm guessing UpdateContext?
  3. How are you sorting your data? If it isn't by a numeric field I can't think of how this would be acheivable.
ChrisR
Level 8

Re: navigate to next item

Taking a guess at what you’re asking, so I'll assume you have a form that displays an initial record, the 1st record by ID.  You want a button that will make your form display the next record by sequential ID.

As @CMee pointed out, deleting a record would cause an issue with just doing an ID+1.

 

Not being entirely sure of your situation, but I’ll take a shot:

OnStart or OnVisible or however you want to set the initial record ID:

Set(varID,First(DataSource).ID)

 

In the Forms Item Property:

LookUp(DataSource,ID = varID)

 

In the “Next” button’s onselect property:

Set(varID,First(Filter(DataSource,ID > varID)).ID)

 

In the “Start Over” button’s OnSelect property:

Set(varID,First(DataSource).ID)

 

 

Above is a direct way but not the most efficient way and it's not delegable. I personally would load the SP list in a collection first, but since I’m not entirely sure what you're doing I'll just keep it simple.

 

Hope it's what you are loking for,

Chris

 

 

PowerApps Training

Piliglish
Level: Power Up

Re: navigate to next item

Hi Chris

 

Perfect !!

 

This is exactly what I have been looking for and you are the first person who has provided me with the way to achieve exactly what I was looking for.

 

I have spoken to over 6 different Microsoft Support technicians, including 3 screen views and not one of them was able to help.

 

Thank you very much

 

Peter

Highlighted
tlroze
Level: Powered On

Re: navigate to next item

So - if I want to put a button in this screen

ss1.PNGwant this button to navigate to next item

 

 

to navigate to the next item:

ss2.PNGI see your directions, but not quite sure where i would set that OnVisible command...

 

here are my screens and their associated items

ss3.PNGss4.PNGss5.PNG

 

 

Thanks in advance!! Smiley Happy

davidstone
Level 8

Re: navigate to next item

While this is marked as solved because the solution 'works', there are still limitations.

  • Doesn't work with delegation > 500 (or max 2000) records
  • Doesn't let you easily sort and browse by anything other than ID

I have therefore added an idea in the PowerApps Ideas forum to make this into a proper function. You can upvote it here: https://powerusers.microsoft.com/t5/PowerApps-Ideas/Next-and-previous-item-function/idi-p/262340

Prithviraj0507
Level: Power Up

Re: navigate to next item

Hi Chris,

 

When i used back arrow functionality, it works fine.but when i clicked it from the item id 1, no items display page is opened---How to avaoid this?

 

Thanks

Prithviraj


@ChrisR wrote:

Taking a guess at what you’re asking, so I'll assume you have a form that displays an initial record, the 1st record by ID.  You want a button that will make your form display the next record by sequential ID.

As @CMee pointed out, deleting a record would cause an issue with just doing an ID+1.

 

Not being entirely sure of your situation, but I’ll take a shot:

OnStart or OnVisible or however you want to set the initial record ID:

Set(varID,First(DataSource).ID)

 

In the Forms Item Property:

LookUp(DataSource,ID = varID)

 

In the “Next” button’s onselect property:

Set(varID,First(Filter(DataSource,ID > varID)).ID)

 

In the “Start Over” button’s OnSelect property:

Set(varID,First(DataSource).ID)

 

 

Above is a direct way but not the most efficient way and it's not delegable. I personally would load the SP list in a collection first, but since I’m not entirely sure what you're doing I'll just keep it simple.

 

Hope it's what you are loking for,

Chris

 

 

PowerApps Training