1

I created the following calculated column in a list which concatonates the List Item's ID property into a HTML Anchor Tag. When the user clicks the link the user is taken to the page specific to the item by virtue of the TestID querystring parameter. Here is the formula I use to generate the hyperlink.

="<a target=_blank href=/sites/SomeSite/SitePages/SomePage.aspx?`TestID="&ID&">Overview Page</a>"`

When I initially define this calculated column all is well and all the links work fine for every item in the list. However, when I edit the properties of any particular list item and then save it, the concatenation fails so the query string of that item is changed omitting the actual ID number like so: "TestID="

Now when the user clicks the link there is no value in the TestID query string so the page's QueryString Filter fails to display the proper item properly.

0

You have two issues

Running into trouble with quotes,

The browser will add double quotes around unquoted Attributes

To insert a double-quote in a Formula text string (already opened as string ith double quote),
you need to escape it with the notation ""

="<a target=_blank 
     href=/sites/SomeSite/SitePages/SomePage.aspx?`TestID="&ID&">Overview Page</a>"`

Needs to become

="<a target=""_blank"" 
     href=""/sites/SomeSite/SitePages/SomePage.aspx?TestID=" & [ID] & """>Overview Page</a>"

[ID] does not behave well

And should, strictly speaking, NOT be used Calculated Columns, it is NOT listed in that list of Avaliable fields for a reason

this one is biting you

Calculated column with ID removes ID number on update

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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