Automatic incrementing IDs

Neat tip from the SharePoint UK User Group (and thank you Dave Hunter) – if you want an automatic, incrementing column on a list…

Create a new calculated column, with =TEXT(ID,”000000″) as the formula and return data type a single line of text. It will give you 000001.

Neat. I didn’t know that ID was a valid command in a calculated column.

Advertisements
Automatic incrementing IDs

4 thoughts on “Automatic incrementing IDs

  1. Chris says:

    All SharePoint lists already have an auto-incrementing column… “ID”. You can show it on your list by simply editing the default list view and selecting the ID column.

    In your example above, you are just creating a calculated column to show the value of the ID column, ID is not a function.

  2. Ah, d’oh, of course. Yeah, that’s pretty obvious, so naturally I didn’t see it.

    Actually, though, the thing that would put some of our customers off is the format of the number – so using the TEXT function is probably the bit I need to remember. I wonder if I could make it do letters too…

  3. Walt says:

    I have used the ID in the past. Have not been able to get the calculated function to work. Keeps coming back as 0000000.

    I think when SP is saving the item the ID is blank(or 0) so the caclulation uses that value. The ID is calculate afterward, at least in my experience.

    1. Hmm. That’s probably true on creation, actually. It can’t have an idea of what it’s ID is until it’s created.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.