0

I have a strange problem with my calculated column.

I want to build a link utilizing the ID of the entry. So I have a formula like this:

="<a href='someurl.html?id="&[ID]&"'>some text</a>"

To have this interpreted as HTML, I changed the type to "Date and time", which is some kind of a hack, but works.

The problem is that on some time, which I wasn't able to reproduce exactly, the formula breaks. From this time the brackets [ and ] are gone, and the link will only contain "ID" instead of the current items ID.

Any ideas? Thanks!

EDIT: I tested a little more. It seems that all existing links continue to work, but all links on new entries won't.

3
  • Are you using SharePoint Online or on-premise?
    – moe
    Jun 26, 2017 at 7:58
  • But even if the bracket goes, the link still works for me Jun 26, 2017 at 8:05
  • 2013 on premise. Yes, the brackets are away when the field is edited again. but as long as I don't save it will work. The problem is that it will stop working at some time in future.
    – avh
    Jun 26, 2017 at 8:41

2 Answers 2

1

The built in ID column is an unreliable and unsupported column to use in a calculated column, which is why it doesn't appear in the list. If you are trying to build a field based on that column, it is best to do it via workflow. I had documented that long back in the 2007 days.

1
  • I did that, and it works. I just wasn't sure if there is another solution. Thanks.
    – avh
    Jun 26, 2017 at 12:42
0

Perhaps you have to use the concatenate function, so SharePoint understands the string you want to return.

=CONCATENATE("<a href='someurl.html?id=";[ID];"'>some text</a>")
2
  • I tried that, but this makes no difference. Please note that your "," must be ";" or the formula won't be accepted!
    – avh
    Jun 26, 2017 at 8:59
  • Depends on the language of SharePoint ;-), but yes lets keep it to en-US
    – bonm014
    Jun 26, 2017 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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