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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Create Records with Au...
Power Apps
Answered

Create Records with Auto-Increment-ID in a powerapp

(0) ShareShare
ReportReport
Posted on by 2

I  am using a phone version of a Powerapp case management template. The template will work for our needs with one exception.  Each record must have a unique and sequential number. I am creating this app to replace a basic MS Access database which cant be converted to work on the web for the long term. So, when a new record is created I need a field, It could be the ID field, to increment to the last record number +1. This data in this field must not be user modifiable. I need this field to be viewable from all data rntry screen and, obviously, included in the filters. I would like to take the template I am currently using and simply make the ID field vieable on all screens if it will correctly increment. Or, if that will not work I would like to create a field that can perform this function for me. This is my first foray into Powerapps so it is unclear to me how to create a new field in the database record and also how to then make it available on the data entry screens. Any assistance will be deeply appreciated. Jim 

Categories:
I have the same question (0)
  • Verified answer
    v-micsh-msft Profile Picture
    on at

    Hi @themurf47,

     

    Yes, that is possible.

    PowerApps could take use of the SQL Server table as the data source, or the SharePoint list, both of them contains feature to generate Auto-Increment-ID.

    Like SQL table Primary Key, or the SharePoint List ID field, which can't be modified by users.

    You may first take a look at the following aricle for How PowerApps works with SharePoint list as a start:

    Generate an app to manage data in a SharePoint list

    If you have any further questions, please feel free to post back.

     

    Regards,

    Michael

  • themurf47 Profile Picture
    2 on at

    Thanks, I will give that a try. No doubt I will have additional questions as I go through the process. Jim

  • nirvana_moksh Profile Picture
    42 on at

    do you have any documentation for Power Apps connecting to on-prem SQL Server for writing back to a table?

  • v-micsh-msft Profile Picture
    on at
  • nirvana_moksh Profile Picture
    42 on at

    thank you for the documentation, I have an app which is up and running and writes back to Excel Online hosted on OneDrive. We do not find this a secure way as we have to give users of the Power App access to the Excel Online as well to successfully make the comment/write back. We want to replace this with a On-Prem SQL Server Table. I am unsure of what rights are needed for the SQL Table besides reader and writer and how to go about replacing this Excel Online connection.

  • Community Power Platform Member Profile Picture
    on at

    Hello, 

    I have the same use case mentioned in this thread. My data source is Excel with multiple sheets configured for multiple screens in the power app. For new records all the data is saving properly except auto incremented IDs. Could you help?

     

  • AzureLearner Profile Picture
    15 on at

    Hi, I want to build similar kind of power app which increments the suffix numbers. I am having mutiple apps . eg. BranchApp , CareApp etc.

    I need to generate BranchApp2  if BranchApp1 exists , same case will be for CareApp.

    Please suggest which type I shoud use canavas type or model driven.

     

  • goldstoned Profile Picture
    12 on at

    H Guys

     

    I am using this code in the default card to increment the ID by 1. But it stops at 10. The field in power Apps is set to a number and the column the sql database is set to a nvarchar. 

     

    First(Sort('[dbo].[Test_App_Staff]',PersonID,Descending)).PersonID+1

     

    why does it stop at 10 ?

     

    any ideas please?

     

    Thanks

  • fdesouz4 Profile Picture
    3 on at

    i have the same issue, you were able to get a solution?

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @fdesouz4 

    My understanding is nvarchar is a text type in Sql.  For the PowerApps formula to work property, the underlying dataset field must be an integer type.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard