cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Salehkhalil
Regular Visitor

How I can show the ID number when create items

93D72313-98ED-4B7C-A936-0452EA97DD77.jpeg

how I can show the ID number from database (share point) in power app screen, as showing in attachment all time give me error 

2 ACCEPTED SOLUTIONS

Accepted Solutions

So I can show the previous ID then +1,

or is there any way?

View solution in original post

@Salehkhalil 

Something along the lines of this will give you the highest ID+1

First(
   SortByColumns(YourDataSource, "YourIDField", Descending)
).YourIDField + 1

 

View solution in original post

6 REPLIES 6
Pstork1
Dual Super User III
Dual Super User III

Unfortunately, the ID isn't assigned by the system until after a new item is submitted.  So you can't show it on creation of a new item.  You can show it when editing an existing item.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

So I can show the previous ID then +1,

or is there any way?

View solution in original post

Pstork1
Dual Super User III
Dual Super User III

You should be able to show the previous highest ID +1.  But that won't be guaranteed to be the right ID.  There are a couple cases where it would show the wrong value.

  • A previous entry was created and then deleted.  Deleted IDs won't be reused so the highest ID currently +1 will be one short.
  • If two people create items at the same time they might both show the same value for highest ID +1, but the resulting items will have different IDs. Only one would be correct.


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Could you support me for writing the code to show the highest ID+1

@Salehkhalil 

Something along the lines of this will give you the highest ID+1

First(
   SortByColumns(YourDataSource, "YourIDField", Descending)
).YourIDField + 1

 

View solution in original post

Pstork1
Dual Super User III
Dual Super User III

@timl 's code should do it.  But remember that is based on the current highest ID and may or may not represent the next ID to be assigned.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,333)