I was approached with a question in class the other day.
A student wanted to know how they could create a log entry that automatically incremented with each entry. At first you would think that a calculated field would do the trick...and it very well may (I have not looked into that option).
However, a much easier solution is to use the [ID] field that is automatically generated in every SharePoint list/library. As soon as a list or library is created, the first entry is numbered [1] and it increments every time a new item is added no matter how the list/library is filtered/viewed...the ID stays with the created entry.
Now that we know we have an ID field build into the list we can start to have some fun with the 'Calculated' field.
Maybe you do not want your entries starting with the number [1]...your entries should be in the thousands. Make a calculated field that has the formula: [ID] + 1000
You can make some really complicated calculations that also involve strings and comparisons.
The ID field can be used in many ways only limited by your needs.
Power BI - Convert a Column into a Comma Delimited list.
-
When grouping data have you ever wanted to keep a summary of the details?
Maybe as a comma delimited list as a single column? I've put together a
sample pr...
5 years ago
10 comments:
In the past week or so I have been trying to find a good way to have some kind of "auto-increment" for a list. I found this ID method as an okay solution but it has some problems. Yes it gives a new number to every item created, but if you delete an item- the ID is not deleted. For example; if you deleted item 3, the list may read 1 2 4 5 etc. I would not want a number to disappear because someone made a mistake. Also, there are some glitches when you use the ID for calculations. So does anyone else know a better solution?
Thanks for posting. This is a quick fix solution. What I usually tell people is that if you can think of it, SharePoint can do it. The question is usually if SharePoint can do it out of the box or if you need a SharePoint Designer/Visual Studio solution. I think what you need would require some extra programming support/research. For the students I typically have in my class, they would use the auto-increment to maintain a log, so even mistakes need to be tracked. If a number is out of sequence, someone can look to the recycle bin to see what was discarded and by whom. I'll definitely keep looking for a more flexible solution and post it when I find it.
I have tried this but it just keeps adding 0 as the id unless I edit the column settings again it doesnt update from 0 or 1000 if using the + 1000. I assume this is because the calulation is done prior to the id getting issued or am I missing something.....
Thanks
James
I cannot get this to work correctly the numbers dont update unless i re edit the column settings. New items just say 0 or 1000. Am I missing something obvious?
Thanks
James
pybe...unless I am looking at how your are configuring your calculated column it would be hard for me to give much more direction. How exactly are you adding your formula to the Calculated Column? You may want to use the SharePoint Site Help (question mark in the upper right) and search for 'calculated column'. It will give you a lot of examples of formulas to use. Let me know if you still cannot make the column work.
you cannot reference an ID column in a basic calculation, in the same way you cannot reference any row besides the current row.
see the section 'using column references in a formula'
http://office.microsoft.com/en-us/sharepointtechnology/HA101215881033.aspx
Kiwi is right...this only works for items currently IN the list. It does not work for items being newly added. After I created the column and saw the values working I never thought to try a new entry. :| I'm looking at another solution now that still uses the calculated column with the ID field, but has each item run through a workflow which would make the ID field work properly...to be continued...
Using this we can accomplish it without doing any programing and it is a relatively simple way of doing it. By using “Calculated” column in SharePoint List we can create auto-increment field. We can accomplish this by creating a new column and choosing the column type as “Calculated (calculation based on other columns)”. And in Formula field, we have to enter [ID]
In fact this will be using the values from “ID” field from SharePoint list that starts from 1.
For example, if we want to start our auto-increment column from 100, we can modify the “Formula” field of Create New column screen, we can have to enter [ID] + 99
Brian try this one:
http://gihanmaduranga.blogspot.com/2012/09/create-auto-increment-number-column-in.html
Worked for me
Post a Comment