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 / Sequence Number in Pow...
Power Apps
Answered

Sequence Number in Power Apps

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello Experts ,

 

I have one field in my power App call ActivityID , i want this activity ID to be auto generated and  increment by 1 whenever new record created, so i am writing this on datacard value.

 

If(Frm_02.Mode= FormMode.New,Concatenate("BG-",Text(Right((Last('BG Activity Recorder').'Activity ID'),Len((Last('BG Activity Recorder').'Activity ID'))-3)+1)),Parent.Default)

 

But this only works when i am continuously working on the app , when i close app and open again its start with some random value which already exist in my SP list.

ideally this code should check last number inserted in the SP list and increment it by one as per the format. regardless from where i am inserting record (Phone or System). when i am generating record from phone it does not take the last inserted activity number. it takes some already exist number. please advise my requirements are below.

: field should generate automatic sequence number when we create new record 

: it should check the last inserted number in SP list and then increment by 1 

: if one person entered record and it saved in SP list , it should take another sequence number.   

Categories:
  • eka24 Profile Picture
    20,925 on at

    Can you show a sample of how the serial number looks like in the SharePoint list.

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

    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

    Hello @eka24 , Thanks for looking into this. below is the screen shot.

    Capture36.PNG

    This is not sort as per activity ID , if it will sort the largest number would be. BG-9 , i am not sure if  the function "last" takes the largest number , because in app every time i am getting BG-10. 

  • eka24 Profile Picture
    20,925 on at

    Last takes the last on the row not the largest.

    I suggest you enable the Autonumber columns in your SharePoint and concatenate BG- with it into another column that is another way.

     

    On your formula, because last or for first is not delegable, you Will have issues unless you include Sort function in your formula.

    I will get back to you later in the day.

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

    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.

     

  • Verified answer
    eka24 Profile Picture
    20,925 on at

    Apart from the Autonumber I suggested, you can change your formula to:

    If(Frm_02.Mode=FormMode.New,
    "BG-"&First(Sort(AddColumns('BG Activity Recorder',"NewCol",
     Trim(Substitute('Activity ID',"BG-",""))*1),NewCol, Descending)).NewCol+1,Parent.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

    Hello @eka24 , Thank you so much for your help it is working fine now after the correction you made in formula.

     

    Have a great day 😀 

  • AndreaBrunello1 Profile Picture
    11 on at

    Hi @eka24 

     

    I would also be interested in your solution, could you please explain how to create a autonumber column on the sharepoint list?

     

    many thanks for the support

  • eka24 Profile Picture
    20,925 on at

    If it about autonumbering with usual numbers as 1,2 3,4 then enable the ID column in sharepoint.

    Otherwise if you meant the solution on this post; check my youtube channel:

    https://youtu.be/wsaMirkf3Pc

     

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

    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.

    Consider Checking My Youtube Channel

  • lascough20 Profile Picture
    112 on at

    Sorry, I know this is an old post but could be very useful. Maybe a silly question (as I am a novice), where is this formula entered?

  • peterdebue Profile Picture
    2 on at

    Thanks, looks great. Where in the DatacardValue, when you create a new record, do you add the formula? Under 'Action', 'Data' or 'Design'?

    Thanks for your support.

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 409 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 252 Most Valuable Professional

Last 30 days Overall leaderboard