cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dhofknecht
Frequent Visitor

Auto-ID Not Displaying in Edit Form

Hi,

  I've got a SQL Database linked to my PowerApp and my autoid isn't displaying on the edit form when creating a new item.  It is generating fine but is there anyway to get this to display when opening up the edit form to create a new record?

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Hi @dhofknecht

 

I do not think it is possible. The autoID is only created then the database receives a request to add a new record so PowerApps has no way of knowing what ID it will chose to assign to newly created record.

 

This is assuming you are using something like this for your auroID column in SQL:

autoID int IDENTITY(1,1) PRIMARY KEY

 

On the other hand, you could display the fake newID which you think will be generated.

You can get LastID from database and just add 1 to it to assume the ID to be generated and display it on the form if you want your users to see the next ID to be added.

 

To get last ID you can utilize Last() function

Last('[dbo]'.'[MyDatabase]').autoID

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @dhofknecht

 

I do not think it is possible. The autoID is only created then the database receives a request to add a new record so PowerApps has no way of knowing what ID it will chose to assign to newly created record.

 

This is assuming you are using something like this for your auroID column in SQL:

autoID int IDENTITY(1,1) PRIMARY KEY

 

On the other hand, you could display the fake newID which you think will be generated.

You can get LastID from database and just add 1 to it to assume the ID to be generated and display it on the form if you want your users to see the next ID to be added.

 

To get last ID you can utilize Last() function

Last('[dbo]'.'[MyDatabase]').autoID

re: "You can get LastID from database and just add 1 to it to assume the ID"

Last('[dbo]'.'[MyDatabase]').autoID

Unfortunately, in a multi-user database, that is not really reliable - since another user may have added a new record in the split second before the Last function is executed via PowerApps. 

DatabaseMX ('mx')
Microsoft Access MVP

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,586)