Skip to main content

Notifications

Community site session details

Community site session details

Session Id : W2fDXcdlBkBji/jrW3UZG1
Power Apps - Building Power Apps
Answered

Form Next record button

Like (0) ShareShare
ReportReport
Posted on 20 Mar 2022 15:03:41 by 24

I have a display form that I want to add a button to take the user to the next record from the list.  I am new to powerapps and not sure how to accomplish this.

Categories:
  • Adrian_Celis Profile Picture
    1,652 Super User 2025 Season 1 on 04 Apr 2024 at 14:52:25
    Re: Form Next record button

    Hi @RobinHan 

    Good point.

     

    Approach 1:

    You can do this approach, but this has a delegation limit

    Previous button

     

    UpdateContext({varRecord:First(Filter(Sort(MyDataSource,ID,SortOrder.Descending),ID < varRecord.ID))})

     

    Next Button

     

    UpdateContext({varRecord:First(Filter(MyDataSource,ID > varRecord.ID))})

     

     

    Approach 2:

    Get the next/previous item by Created date. This will not work if your items are created in bulk at the same time

    Previous Button

     

    UpdateContext({varRecord:First(Filter(Sort(MyDataSource,ID,SortOrder.Descending),Created < varRecord.Created))})

     

    Next Button

     

    UpdateContext({varRecord:First(Filter(MyDataSource,Created > varRecord.Created))})

     

     

    Approach 3:

    You can have a helper column that is a number type. Everytime you patch, you patch a sequential number in that column. This will not have the delegation warning. Let say we call our helper column Sequence.

    Previous Button

     

    UpdateContext({varRecord:First(Filter(Sort(MyDataSource,ID,SortOrder.Descending),Sequence < varRecord.Sequence))})

     

    Next Button

     

    UpdateContext({varRecord:First(Filter(MyDataSource,Sequence > varRecord.Sequence))})

     

     

  • BHS_KI Profile Picture
    183 on 03 Apr 2024 at 17:26:22
    Re: Form Next record button

    you are absolutely right. That was also my first thought

  • RobinHan Profile Picture
    4 on 17 Oct 2023 at 08:14:09
    Re: Form Next record button

    Hi, thanks. but how about if the data source record were deleted, so the record ID will  not be continue. 

    then this way via the ID +1 or -1 should be not work perfectly. any other better solution? 

  • Blarue Profile Picture
    76 on 13 Oct 2023 at 13:17:19
    Re: Form Next record button

    @TimothyTrimble I found another way to achieve this same effect.  its a bit more work but it may be due to the fact that my gallery is filtered, not sure but here it is. 

    My Gallery has a button/Icon with OnSelect property set to Select(Parent) and navigate to the screen with the edit form.

    The Edit form's screen has it's On Visible property set to Set(varRecord, MyGallery.Selected.ID)

    On my next button/icon I have on the OnSelect property 

    Set(varRecord,Min(Filter(MyGallery.AllItems,ID > varRecord),ID))

    and on the my back button/icon' OnSelect property Set(varRecord,Max(Filter(MyGallery.AllItems,ID < varRecord),ID))

    And lastly, my item property on my form is set to LookUp(MyDataSorce ID = varRecord)

  • Adrian_Celis Profile Picture
    1,652 Super User 2025 Season 1 on 13 Oct 2023 at 09:53:09
    Re: Form Next record button

    Hi @TimothyTrimble @Blarue 

    Late reply. But did you put varRecord in the Items property of your form?

  • Blarue Profile Picture
    76 on 12 Oct 2023 at 15:47:26
    Re: Form Next record button

    Same here, what step is missing?

  • TimothyTrimble Profile Picture
    14 on 23 May 2023 at 19:31:55
    Re: Form Next record button

    Is there any other action needed? I added two icons to the top of my details form and added the functions. Nothing happens when selected. 

    TimothyTrimble_0-1684870283461.png

     

  • Adrian_Celis Profile Picture
    1,652 Super User 2025 Season 1 on 21 Mar 2022 at 23:09:11
    Re: Form Next record button

    Hi @ksmith23 

     

    For example, if you have a gallery for your data source in the same screen, you can have a button in a gallery and on its OnSelect property, you can set a variable named varRecord like:

    UpdateContext({varRecord:ThisItem})
  • ksmith23 Profile Picture
    24 on 21 Mar 2022 at 13:28:43
    Re: Form Next record button

    How do I set the variable for the form on the Items?  I am not sure of the formula I need to use.

  • Verified answer
    Adrian_Celis Profile Picture
    1,652 Super User 2025 Season 1 on 21 Mar 2022 at 01:32:42
    Re: Form Next record button

    Hi @ksmith23 

    Here's a start. You can have your selected record as a variable (for this example let's call it varRecord).  Then in your Next button you can add a function to go over the next record.

     

    UpdateContext({varRecord:LookUp(YourDataSource,ID=varRecord.ID + 1)})

     

    Adrian_Celis_1-1647826414845.png

     

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,702 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,015 Most Valuable Professional

Leaderboard