cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
praveencb16
Level: Powered On

Autoincrement of a number in Powerapp

I am using SharePoint list customize form and creating an auto increment request#. Sharepoint is the datasource. Using the formula Last('Training-Request').'Request#' + 1 in powerapps, where Request# is a column on the sharepoint list and Training-Request is the name of the list. But if two persons simultaneously try to create a request OR if the second person tries to create a request before first person saves it and when second person tries to save, it shows an error that the number is not unique. Seems both the requests pulls the same last request number.

Request your help on how to resolve this issue. I

There is an autoincrement ID in Sharepoint, but it starts with 1, but need to start from a different number, that is why im not using sharepoint ID column.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Autoincrement of a number in Powerapp

@praveencb16 

This is one of those conditions you're going to have to plan around.  You are definitely going to have situations where multiple users on new or updates will race the results.  

What you might consider is putting in a separate "supporting" list to your SharePoint list.  In that list you could have one record with the currentRequestNumber in it.

Then, when you go to submit, do a lookup on that list to get the "at this moment" current request number.  Then update your list with it and also update the supporting list with that.  This way, when the second user goes to submit, their submit will do the same.  You'll always have an accurate number that way.

You could also do this as part of your actual list (using Max function and so forth), but I don't know if you will ever run into delegation issues with your first list that could cause problems with that.  I can, however, pretty much guarantee you that you'll never have a delegation issue with 1 record in the supporting list.

 

Just a suggestion - hope it sheds some fuel for thought.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

4 REPLIES 4
Super User
Super User

Re: Autoincrement of a number in Powerapp

@praveencb16 

This is one of those conditions you're going to have to plan around.  You are definitely going to have situations where multiple users on new or updates will race the results.  

What you might consider is putting in a separate "supporting" list to your SharePoint list.  In that list you could have one record with the currentRequestNumber in it.

Then, when you go to submit, do a lookup on that list to get the "at this moment" current request number.  Then update your list with it and also update the supporting list with that.  This way, when the second user goes to submit, their submit will do the same.  You'll always have an accurate number that way.

You could also do this as part of your actual list (using Max function and so forth), but I don't know if you will ever run into delegation issues with your first list that could cause problems with that.  I can, however, pretty much guarantee you that you'll never have a delegation issue with 1 record in the supporting list.

 

Just a suggestion - hope it sheds some fuel for thought.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

TopShelf-MSFT
Level 10

Re: Autoincrement of a number in Powerapp

Thanks for posting in the community @praveencb16 - can you review the above reply and update the thread if it was helpful?

 

Thank you,

 

@TopShelf-MSFT 

praveencb16
Level: Powered On

Re: Autoincrement of a number in Powerapp

Thanks for the suggestion. But even if i collect the data at the time of submitting, it collected the data when powerapps was opened. Refreshing the sharepoint page before submitting resolved the issue. Im not sure if there is anything missing, but it seems to work. 

Super User
Super User

Re: Autoincrement of a number in Powerapp

@praveencb16 

The key in the suggestion was that "when you go to submit" THEN you do the lookup on the value in the list to get the latest number to use.  Chances of that being duplicated would be rare.

Sounds like you are getting through it though, so that's good, but keep it in your back pocket in case you run into the issue again.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,018)