cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
radhe
Level: Powered On

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
Community Support Team
Community Support Team

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

8 REPLIES 8
Community Support Team
Community Support Team

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.
radhe
Level: Powered On

Re: Auto generate number list

Thank you for reply.

 

But how can we increment last number?

 

CAR-12122018-001

CAR-12122018-002 like this.

 

 

Community Support Team
Community Support Team

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

radhe
Level: Powered On

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'.

Super User
Super User

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
radhe
Level: Powered On

Re: Auto generate number list

Thanks ScottShearer.

 

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

 

Thank you!

radhe
Level: Powered On

Re: Auto generate number list

Can you please help.

radhe
Level: Powered On

Re: Auto generate number list

I have done and getting result as per me.

Thanks everyone for support me.

test.pngtest1.png

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 352 members 6,704 guests
Please welcome our newest community members: