Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I created a calculated column with the following formula:

="<a  href='../X_C03 Staff Members/DispForm.aspx?ID="&ID&"'>View</a>"

and included this into a view. The column works OK (i.e. opens the Display form) as long as you do not save changes after editing. Once this happens, the field value of the ID of the correponding listitem is missing. Instead of

../X_C03 Staff Members/DispForm.aspx?ID=24

the link looks like:

../X_C03 Staff Members/DispForm.aspx?ID=

However, as soon as I go to List Settings, open the properties of this column, and click save without changing anything, WOOOPS, the ID-field value is again included.

Can someone please explain this behavior?

share|improve this question
Did you find a solution? I am facing the same problem. Thank you. Dave – user10390 Aug 29 '12 at 3:08
@dave: Please see my answer below. – Stuart Pegg Sep 24 '12 at 12:10

1 Answer

Unfortunately [ID] isn't actually a supported field in calculated columns.

When a new item's values are being processed it doesn't yet have an ID, so the calculated field has nothing to work with. Since it's the same code that recalculates the item's values on edit, it doesn't bother looking for the ID then either.

However, when the calculated field is edited all the items have IDs, so they're used to recalculated the values. I can only assume there's slightly different processing being used.

This is very similar to the use of Version mentioned here: Using SharePoint version number in calculated column?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.