Question

I have a calculated column in a custom SharePoint 2007 list, with the following formula:

=CONCATENATE("IR-",[ID],"-",LEFT(UPPER([Title]),25))

If an item is created in the list, everything is fine, however, when an item is updated the [ID] column is no longer in the calculated column for that item.

So, on creation: "IR-40-TheTitleIsHere", but after edit, it is, "IR--TheTitleIsHere".

Anyone have some insight on why this would be happening?

Was it helpful?

Solution

I confirm the behavior mentioned above. Any Add/Edit will wipe out the [ID] portion. If you edit the column in the list and update the formula, it will update ALL list items to be correct (until you do an edit on the item).

I found this post that mentions the same problem.

Sounds like the only solution would be to make a simple workflow using SharePoint Designer that would update a text field in your list.

OTHER TIPS

I had an issue similar a while back. Through other blogs and experts, I discovered that the [ID] column should not be used in a calculated column because it wreaks havoc and causes many errors. Sorry - remove the ID column and you should be fine.

This question is a little old, but I had the same issue and found a solution for it. It is a pretty specific fix and won't help everyone -- it involves using javascript in a content editor web part to update the calculated field.

This site -- http://blog.pathtosharepoint.com/2008/09/01/using-calculated-columns-to-write-html/ -- gives an example of how to use javascript in the same manner that I used it.. the important block of code is the first while loop. The point is to grab the out of box ID column from the list and update whatever calculated field needs the ID.

In my case I had a URL in a calculated field that required the ID as a parameter.. of course that wouldn't work normally because you can't put the ID in a calculated field. What I did was I put "?ID=null" in the ID parameter of my calculated field's url, I then replaced that with the ID that was retrieved using javascript.. so whenever the page is loaded, the js kicks off and updates all of the URLs to have the correct ID.

I know this is very old but I couldn't find a newer version of the question anywhere else and the answer above from ferr solved the problem for me but isn't very clear so I thought I'd update it.

This assumes that you want to use the ID in the output HTML (for example within a link), I think this is fairly common.

Using the javascript from the pathtosharepoint link I added in the following to get the id with an if statement for safety:

if (HTMLregexp.test(CellContent)) {    //original pathtosharepoint line
   if (NodeSet[i].parentNode.getAttribute("iid")){
      var SPID = NodeSet[i].parentNode.getAttribute("iid").split(",")[1];
      CellContent = CellContent.replace("SPIDReplace", SPID)
   }
NodeSet[i].innerHTML = CellContent;   //original pathtosharepoint line

This is put in the while loop of the latest pathtosharepoint fix at time of writing. This works for me on SharePoint 2010. Note: Include the string "SPIDReplace" in your calculated column to get it replaced by the item ID.

pathtosharepoint page: http://blog.pathtosharepoint.com/category/calculated-columns/ pathtosharepoint code: http://pathtosharepoint.com/Downloads

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top