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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Incremental ID not pop...
Power Apps
Unanswered

Incremental ID not populating while using SubmitForm()

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hey everyone, 

 

I'm using a form to add data to a onedrive file. One of the columns is an ID column that I essentially use as a count (starts at zero and adds one each time). When I use SubmitForm() all of my data submits properly except the ID column which remains blank. Here is what I use to populate the ID column: 

 

First(Sort(Table1,ID,Descending)).ID+1

 

Has anyone experienced a similar issue? 

 

Thanks! 

Categories:
  • eka24 Profile Picture
    20,925 on at

    Try

    If(FormName.Mode=FormMode.New,

    First(Table1).ID+1,Patent.Default)

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks for the response. I think that would work if I was starting at 0 but I started with 566 records so the count is already at 566. 

  • eka24 Profile Picture
    20,925 on at

    It will work with whatever the number you have. The formula is existing plus 1.

    You should have tried it

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I did and it didn't work.

     

    First() grabs the first row in the table, which in my case has ID=1 (since I have existing records). Since I used first() the ID on the form populates as 2. However, when I submit the form, it doesn't submit anything for ID so that cell is now blank which powerapps reads as zero. Thus, every time I add a new record in the table, it has ID=1. 

     

    To help clarify my original question, I currently have 556 records (with ID starting at 1 and ending at 556). Thus the next ID should be 557 which "First(Sort(Table1,ID,Descending)).ID+1" correctly displays on the form. However, when I click a button which OnSelect calls SubmitForm(FormName), the ID column in my onedrive table doesn't populate. 

     

    Let me know if there's still confusion.  

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @Anonymous 

    When I want to manually increment an ID column in a form, I set the Update property of the ID card to 

    If(IsBlank(Parent.Default),First(Sort(datasource,ID,Descending)).ID+1,ParentDefault) and hide the card. Make sure that the Column type is number in your Excel table. 

  • eka24 Profile Picture
    20,925 on at

    It should be last;

    If(FormName.Mode=FormMode.New,

    Last(Table1).ID+1,Patent.Default)

     

    Sorry about that

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @eka24 

    You will eventually run into delegation problems if you use Last() or Max().  First(Sort( Descending) will always work.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I think we're on the right track here. Is there a reason why I can't use parent.default in the update property? 

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    You could just use

     

    If(IsBlank(ID),First(Sort(ExcelTableName,ID,Descending)).ID+1,ID)

     

    assuming ID is the column name in the Excel table. 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard