Hello everyone.
I’m building an App for my company. I have the next situation.
My database is a Sharepoint List that has two columns called DESCRIPTION and ID. The column ID is from Sharepoint and is only required for count each record.
I have a Form for the people of my company fill up it. The field of this form is DESCRIPTION and my goal is when each person fill up this field, the app show the next ID (Last ID + 1) but when we want to edit some récord don’t create other ID.
Thanks for your support.
Solved! Go to Solution.
Hello @RandyHayes .
I understand you, but I was doing that (Update the DataSource) and the problem continue. See the next figure.
The last figure is about my DataSource. I was removing some rows and then I updated my DataSource in Power Apps but the app doesn't recognize that change and shown all remove records.
Thank you for your support.
Be aware that SharePoint Id's are not reused even if you delete them. Randy's formula will still give the next value as though the deleted rows were still there. This behavior is by design and makes sense. If Id's were reused once a record was deleted. The database would be corrupted.
You can get the next ID with the following formula:
First(Sort(yourDataSource, Created, Descending)).ID
You haven't provided much detail on the form, or where the number goes, but from the above, you can get the last ID and then add 1 to it.
Keep in mind that doing this may not be accurate as, if you have multiple users of your app, another person can add a new record with a higher ID during the time that the first person does the same. PowerApps will not recognize that someone else has added a record automatically.
I hope this is helpful for you.
Hello @RandyHayes.
This is my Form.
Actually the last number is 245 and I need that: First record will be 246. The next one 247, etc.
I have a problem with your answer because the consecutive is above from my last number. When i fill up a test record, the visual element take into account the last test records, even though the data source does not contain this answers
Relevant data:
Form name: Registro
Data Source: SDM, HK-5221
Last Record Number: 245
Thank you for your support.
@PabloLopez Along with @RandyHayes provided, before you save, filter the datasource with the ID you have calculated to see whether another user already created the record.
@PabloLopez Along with @RandyHayes provided, before you save, filter the datasource with the ID you have calculated to see whether another user already created the record.
If that formula is showing you 259...then you have a 259 in your list!!
If you have been deleting or changing records in the list while you have been working on the app, make sure you have refreshed the datasource in the designer. It will not automatically update itself if you change anything in the list manually.
Hello @RandyHayes .
I understand you, but I was doing that (Update the DataSource) and the problem continue. See the next figure.
The last figure is about my DataSource. I was removing some rows and then I updated my DataSource in Power Apps but the app doesn't recognize that change and shown all remove records.
Thank you for your support.
If you do a refresh on the datasource, then it should get the new values and exclude the ones removed.
From that photo, if you refresh your datasource, then the formula should be showing you 268.
What does it show?
Be aware that SharePoint Id's are not reused even if you delete them. Randy's formula will still give the next value as though the deleted rows were still there. This behavior is by design and makes sense. If Id's were reused once a record was deleted. The database would be corrupted.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
192 | |
67 | |
46 | |
41 | |
22 |
User | Count |
---|---|
252 | |
121 | |
84 | |
80 | |
71 |