cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MikeHuang
Frequent Visitor

Create the auto increased number in Sharepoint

Hi guys,

I have a stupid question how I can setup the number auto increase format of field in the Create item, I want to this field like 0001,next is 0002 when a new item created.

flow.jpg

 

Thanks

13 REPLIES 13
manuelstgomes
Super User II
Super User II

HI @MikeHuang 

 

It's not a stupid question, actually a good one.

 

You can't create auto-incrementing numbers. You need to keep track of the next number automatically. I would recommend the following:

Create a SharePoint with your increment values. You may need it for other Power Automations. Then have the current id as a numeric value and the "nextID" as a calculated field where you can increment and format it as you want (in this case like '0001').

Then, before the "Create item," all you need to do is fetch the nextID and save it. After that, update the column with the new id incremented.

 

I know it's not ideal, but its the way to go.

 

I warn you that some may recommend using SharePoint's native ID. It's a sequential number, but I got terrible experiences in the past using that in calculated fields. Also, if you delete a row and add a new one, you'll break your sequence.

 

Hope this helps you and it's clear. If I'm missing something please let me know and I'll try to help you further.

 

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

Cheers
Manuel

 

I know it's not ideal

Hi Manuel,

Thanks for your answering.

I some how understand your logic, so it works with two columns. A=A+1 then B= A, I don't how to setup this A=A+1 in Sharepoint.

Can you tell me where to do it, and what is the formula in Sharepoint?

 

Thanks

Mike

Hi @MikeHuang,

 

If there are some items already have created in the list of SharePoint, and their sequence is normally increasing, you can use the get items to get the last item, then initialize an int variable to store it. For example:

-Get the last item created in List 1:

Annotation 2019-11-13 160151.png

Initialize an integer variable, then put the Title get from the previous step into the variable. If the Title is String type, you should convert it into an int.Annotation 2019-11-13 160309.png

 After that, you can use the Increment variable action to increase the Title, the value is increase number each time.Annotation 2019-11-13 160538.png

 

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

 

 

 

 

Hi @MikeHuang 

 

It's super simple. You need a calculated column.

small-Screenshot_2019-11-13_at_09_56_50.jpg

 

Also, I build the formula so that you can display the code. It's a calculated column also, and it looks like this.

small-Screenshot_2019-11-13_at_10_07_47.jpg

 

The result is:

small-Screenshot_2019-11-13_at_10_07_16.jpg

 

Looks good, right? 🙂

If you still have questions, please let me know, and we'll figure this out together

 

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

Cheers
Manuel

Hi Liu Tu,

Thanks for your answering.

I did a try but I get this error.

 

approve.jpg

Hi @MikeHuang,

 

Please add the Get items action before that, then set the Order By and Top count as below:Annotation 2019-11-13 160151.png

Then, create an Apply to each action to put the value of Get items.

After all, put the set variable action into the inside of Apply to each action.

 

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

Hi Manuel, 

Now I get you most idea:)

One thing how you make the column [int number] auto - increased from 1->2->3?

 

Thanks

Mike

Hi Lin Tu,

Thanks for your answering.

I am not sure if this is correct way to use this function here.approve.jpg

Thanks 

Hi @MikeHuang,

 

Yes, you are on the right way, please put the value of Get items into the Apply to each, and set variable into the body of Apply to each, please refer to this sketch map:

Annotation 2019-11-19 161726.png

Just like below:

Annotation 2019-11-19 161749.png

 

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

Hi @MikeHuang,

 

Has your problem been solved?
If your problem has been solved, You could go ahead and mark the post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!

Best Regards,
Community Support Team _ Lin Tu

HI @MikeHuang 

 

The column is always ahead of one number. That's the beauty of this solution. You can refer to it and use the other calculated column for the parsed value, and you're good to go.

 

Simple and elegant :).

 

Please let me know if this solved your problem. Otherwise, we can check another solution that works for you.

 

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

Cheers
Manuel

Hi Lin Tu,

I can't make this working.

I think I need try other thing.

 

Thanks

Thanks for your help.

 

The column is always ahead of one number?  where to find it?

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (3,400)