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 / Automatic Sequential I...
Power Apps
Unanswered

Automatic Sequential ID How to

(0) ShareShare
ReportReport
Posted on by 11

Hi everyone,

 

I have built an app that is used for shifts closing in ticket agency. The user insert his daily data and the app collects them to a Sharepoint list. So each row in the database, refers to the daily record of a single employee. 

 

I would need to add a column in the Sharepoint list that collects the transaction ID, having as prefix the agency code (it is selected by the user during each transaction through a dropdown list) + sequential number from 1 on (has to be automatically generated). The sequential number has to be based on the prefix, meaning that:

MUC - 1

KOL - 1

MUC - 2

BER - 1

and not

MUC - 1

KOL - 2

MUC - 3

BER - 4

 

could you please support me on that?

 

many thanks! 🙂

Categories:
  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    Hey! You need to Split the function and, after that add 1 and "re-add" the perfix

     

    If you need additional help please tag me in your reply and please like my reply.
    If my reply provided you with a solution, pleased mark it as a solution ✔️!

    Best regards,
    Gonçalo Nogueira

    Check my LinkedIn!

    Check my User Group (pt-PT)!

     

  • eka24 Profile Picture
    20,925 on at

    I have done a tutorial on autoincrement which has that example:

    https://youtu.be/wsaMirkf3Pc?t=1

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

    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.

     

  • WarrenBelz Profile Picture
    156,774 Most Valuable Professional on at

    Hi @AndreaBrunello1 ,

    Assuming you have the current number in a field, the next number in an added field would be

    AddColumns(
     YourList,
     "NextNo",
     With(
     {
     wLeft: 
     Left(
     YourCurrentField,
     3
     ),
     wNo: 
     Last(
     Split(
     YourCurrentField,
     " - "
     )
     ).Result
     },
     wLeft & " - " & Value(wNo) + 1
     )
    )

    Is this what you are trying to do as it is not clear in your post

     

    WarrenBelz_0-1632386860454.png

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • AndreaBrunello1 Profile Picture
    11 on at

    Ehi @Nogueira1306  thanks for answering!

     

    I actually still have no function for doing that. Any ideas?

  • AndreaBrunello1 Profile Picture
    11 on at

    Hi @WarrenBelz  and thanks for answering!

    Yes that looks like what im am trying to achieve. 

     

    I will try to be more clear:

    I need to have a function that generates an ID per each transaction submitted by the users. This ID have to be saved in the sharepoint list called "LIST" where all the input inserted by the users, in a column named "TransactionID"

    The user while using the app has to select from a dropdown list "drdAgency" the agency code of his shop. (not all the agency codes are made of the same number of digits, can be both 4 or 5 numbers)

    The ID associated to the transaction then has to be as follow

    "XXXXX" - "YY"

    where XXXXX is the agency code , that was selected by the user

    YY a autoincremented number

    basically the function should read the sharepoint column "Transaction ID" , get the last ID with same prefix and highest number, and generate a new ID with prefix and highest number + 1

     

    I hope now I was more clear 🙂

    thanks for supporting

  • WarrenBelz Profile Picture
    156,774 Most Valuable Professional on at

    Hi @AndreaBrunello1 ,

    This is not a straight-forward solution - I seem to have it working with the below, where colXXXX is your List with the current field in the Code field and colYYYY your current collection with the code in the Value field

    AddColumns(
     colYYYY,
     "NextNo",
     With(
     {
     wNo: 
     With(
     {
     wLast: 
     LookUp(
     Sort(
     AddColumns(
     colXXXX,
     "Code3",
     Left(
     Value,
     3
     )
     ),
     Value,
     Descending
     ),
     Code3 = Code
     ).Value
     },
     Last(
     Split(
     wLast,
     " - "
     )
     ).Result
     )
     },
     Code & " - " & Text(Value(wNo) + 1)
     )
    )

     

    WarrenBelz_0-1632440571264.png

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 225

#3
M Bilal Khan Profile Picture

M Bilal Khan 192

Last 30 days Overall leaderboard