cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

Auto generate number list

I have 1 list with this format.

 

 

based on request 

Jillchange requestCAR-12122018-001
EveNew hire employeeNH-12122018-001
JohnNew consultantCON-12122018-001
WillTerminationTR-12122018-001
   
   

 

I want auto-number the "Number" column based on "request type" column. If I add a new request for change request, the "Number" field must be "CAR-12122018-001".

 

How can I do that?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Auto generate number list

Hi @radhe,

 

The part I can do on my side here is to find the largest Number, but the format may not be displayed as "001,002", only "1, 2, 3" can be displayed.

Using variables to store the last three digits of Number requires first converting them to a numeric type.

Then use the Max () function to get the maximum value, after adding the maximum value with 1, use concat () function to append the number after "CAR-12122018-", and then configure it in Update item action.

Expression reference:

int(last(split(items('Apply_to_each')['Number'],'-')))

max(variables('Number'))

concat('CAR-12122018-',string(add(outputs('Max'),1)))

Image reference:

22.PNG23.PNG

Take a try.

 

Best Regards,

Barry

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
Highlighted
Community Support
Community Support

Re: Auto generate number list

Hi @radhe,

 

Do you want to update Number column based on the value of request type column?

You could use When an item is created as the trigger, then configure Condition, if it meets the conditions you said, then update Number to the corresponding value.

Image reference:

12.PNG

Please take a try.

 

Best Regards,

Barry

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Advocate II
Advocate II

Re: Auto generate number list

Thank you for reply.

 

But how can we increment last number?

 

CAR-12122018-001

CAR-12122018-002 like this.

 

 

Highlighted
Community Support
Community Support

Re: Auto generate number list

Hi @radhe,

 

The part I can do on my side here is to find the largest Number, but the format may not be displayed as "001,002", only "1, 2, 3" can be displayed.

Using variables to store the last three digits of Number requires first converting them to a numeric type.

Then use the Max () function to get the maximum value, after adding the maximum value with 1, use concat () function to append the number after "CAR-12122018-", and then configure it in Update item action.

Expression reference:

int(last(split(items('Apply_to_each')['Number'],'-')))

max(variables('Number'))

concat('CAR-12122018-',string(add(outputs('Max'),1)))

Image reference:

22.PNG23.PNG

Take a try.

 

Best Regards,

Barry

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Advocate II
Advocate II

Re: Auto generate number list

error:

The variable 'Number' of type 'Array' cannot be initialized or updated with value '001' of type 'String'. The variable 'Number' only supports values of types 'Array'.

Highlighted
Super User III
Super User III

Re: Auto generate number list

@radhe:

 

Here is another way of approaching getting the max number that might be a little less complicated.

 

In the example below, I am sorting the items I get back from Get Items in descending order based on my number column.  Also, I am limiting the records that I get back to 1 - therefore, Get Items will only return the row of data with the max number.

 

Please note that the sort parameter uses the SharePoint internal column name.

 

MaxNum.jpg

 

The loop where I assign a value to my variable will only execute once since only 1 row is returned.

 

Scott

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Highlighted
Advocate II
Advocate II

Re: Auto generate number list

Thanks ScottShearer.

 

cloud you please send me all steps,so i can try my end.

 

Thank you!

Highlighted
Advocate II
Advocate II

Re: Auto generate number list

Can you please help.

Highlighted
Advocate II
Advocate II

Re: Auto generate number list

I have done and getting result as per me.

Thanks everyone for support me.

test.pngtest1.png

Highlighted
Post Patron
Post Patron

Re: Auto generate number list

Just one thing do you have any idea how can you create the Autogenerated IDs?

such that when the record is created has a unique ID and if deleted should be reset for a new one just as we do it in SQL and EXCEL when the record is created, updated and deleted? 

 

 For example: 

 

SPList Name is CashApproval 

 

columns :  new generated after user input 

ID Employee NameStatus 
1Tapesh Approved 
2Sam Pending 
3Fiona Rejected 

 

 

columns : updated  after user edited form 

ID Employee NameStatus 
1Tapesh Approved 
2FionaPending 
3SamRejected 

 

columns :  Deleted delted after the entry deleted 

ID Employee NameStatus 
1Tapesh Approved 
2Sam Pending 
   

 

Can this be possible by power apps ID filed as the user sends a request form?

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (5,537)