Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Calculated Fields and the ID Column

  Asked By: Edmond    Date: Sep 27    Category: Sharepoint    Views: 12268

I have a problem with WSS v3 and calculated fields.

I am trying to create a custom list which provides a auto-numbered
column, based on the ID field.
I happily did this first with the UI, which at first glance worked
ok. I had a calculated field which was something like this:
However if I add a couple of records, the cacluated field
(named 'Reference') would have the value "PRJ1000" each time. If I go
back in to the list settings and view the formula for the field
again, then click save, when I go back to the list item once more,
the field is populated properly, e.g. "PRJ1001, PRJ1002".
In understand that this is probably because when the list item is
saved for the first time, the ID column is NULL.

I moved on to creating the list as a custom list definition, as I
read somewhere that this may solve the problem.
But when I add the calculated field in the Schema.xml, I get a
SharePoint error. (I got the info from a blog
which was for WSS v2 - I suppose I shouldn't be surprised to find it
Can anyone assist me in making this work for V3?
I am an Admin rather than developer, so if the answer requires more
than 6 lines of XML, you may have to be quite specific.



1 Answer Found

Answer #1    Answered By: Christop Mcfadden     Answered On: Sep 27

You will probably want to write a simple class that inherits from
SPItemEventReceiver and overrides ItemAdded. Then create  a Feature to
deploy the Event Receiver onto lists of a given type within a given
scope. If that doesn't make sense, ask a follow up question.

Didn't find what you were looking for? Find more on Calculated Fields and the ID Column Or get search suggestion and latest updates.