web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Incremental number bas...
Power Apps
Answered

Incremental number based on submission

(0) ShareShare
ReportReport
Posted on by 215

Hello experts,

 

I am collecting the form details for visitor requests. There are 2 options to submit request. Single submission and Multiple visitor request submission. For multiple submission, I am collecting the list of records in a collection and patching the multiple records in the SharePoint list. I use different submit buttons for each type of submission. Please refer the screen shots attached. 

 

I am already using Unique ID in SharePoint list for some references. My requirement is, I need to create Incremental Visit-ID. If the request is submitted as Single visitor request - the ID should be say "1". If the next request is a multiple request submission and say there are 4 records, when I patch the data in SharePoint I need the Visit ID for all 4 records to be say "2".  Basically need to group each request and have an incremental number. Any help is highly appreciated.

image2.PNG
image1.PNG
Categories:
I have the same question (0)
  • BCBuizer Profile Picture
    22,565 Super User 2026 Season 1 on at

    Hi @PowerUser19 ,

     

    I assume you have figured out how to patch the requests to your SharePoint list and are only looking for a method to assign a unique number.

     

    For that, you can use the below example to populate the 'Unique ID' column (or whatever name you have):

     

    {'Unique ID': Text(Value(Last(Sort(SharePointList,'Unique ID')).'Unique ID')+1)}

     

    The Text and Value function are only included because I assume you are using a Text type column. If it is a number type, you have to leave them out:

    {'Unique ID': Last(Sort(SharePointList,'Unique ID')).'Unique ID' +1}

     

  • PowerUser19 Profile Picture
    215 on at

    Hi @BCBuizer ,

    Thanks for the response. I am still facing difficulty with creating the incremental number. 

    Yes, I am able to patch other fields from the form. I need help with the incremental number. 

    I tried the below code. The SharePoint VisitID is still empty after the below code is executed. VisitID is a number column in SharePoint list. I tried with and without "Text(Value" but no luck. I am sure missing something. 

    Patch(VisitorRequestList,LookUp(VisitorRequestList,Title=DataCardValue46_2.Text),{'Visit ID':Text(Value(Last(Sort(VisitorRequestList,'Visit ID')).'Visit ID'))+1})

    and 

    Patch(VisitorRequestList,LookUp(VisitorRequestList,Title=DataCardValue46_2.Text),{'Visit ID':Last(Sort(VisitorRequestList,'Visit ID')).'Visit ID')+1})

     

    If a single request is submitted, the database should have an incremental visit ID. 

    If multiple requests are submitted at the same time, the visit ID should be same for all requests. 

    Single Request: 

    Bob - Visit ID - 1

     

    Multiple Requests:

    Jim - Visit ID - 2

    Ken - Visit ID - 2

    Joe - Visit ID -2

     

     

    I cannot use the above code in case of multiple record submission. Because I cannot check the title = datacardvalue. I need the VisitID to be same for all the records submitted in the multiple request form.

  • Verified answer
    BCBuizer Profile Picture
    22,565 Super User 2026 Season 1 on at

    Hi @PowerUser19 ,

     

    This code was only meant to generate a new VisitID upon creation of a new item, not to update existing items. It should be included in the Patch statement you already have for the creation of new items.

     

    Come to think of it, in the case of multiple new items this will not work as it will keep incrementing the VisitID after each item, even if they belong to the same visit request. 

     

    What you'll have to do is save the value in a variable and then use that in your Patch:

     

    UpdateContext(_VisitID: Last(Sort(SharePointList,'Unique ID')).'Unique ID' +1});
    ForAll(
     //Items you want to save in your data source
     Patch(VisitorRequestList, Defaults(VisistorRequestList, 
     {
     //..... 
     'Visit ID' : _VisitID
     }
     )
    );

     

  • PowerUser19 Profile Picture
    215 on at

    Hi @BCBuizer ,
    Thanks a lot. Saving the value in a variable and incrementing it worked! 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
wolenberg_ Profile Picture

wolenberg_ 119 Super User 2026 Season 1

#2
WarrenBelz Profile Picture

WarrenBelz 107 Most Valuable Professional

#3
Haque Profile Picture

Haque 103

Last 30 days Overall leaderboard