If this has already been posted, apologies. I could not find this searching the forum.
tl;dr: Escape ampersands in HTML Items, even on Source Type = Text from the UI.
We had a need to create Active Reports with links to external application that passes parameters based on the line chosen in the Active Report. The building of a simple link with target as new windows is easy enough using HTML Items (multiple in the same column in this case), but passing the parameters causes the following error:
"HTML report output is not well formed. If your report uses "HTML Item" elements ensure that they result in well-formed HTML
reason: EntityRef: expecting ';'"
The properties of the HTML Items were:
1 - Source Type: text - HTML: <a href="http://server/path/?event=event&value=
2 - Source Type: Data Item Value - Data Item Value: COLUMN
3 - Source Type: text - HTML: " target="_blank">Link</a>
looking at the XML source this is translated to:
<HTMLItem>
<dataSource>
<staticValue><a href="http://server/path/?event=event&value=</staticValue>
</dataSource>
</HTMLItem>
<HTMLItem>
<dataSource>
<dataItemValue refDataItem="COLUMN"/>
</dataSource>
</HTMLItem>
<HTMLItem>
<dataSource>
<staticValue>" target="_blank">Link</a></staticValue>
</dataSource>
</HTMLItem>
The fix to this and the way to pass in the URL parameter is to escape the ampersand character and only the ampersand character:
The properties of the HTML Items after fix:
1 - Source Type: text - HTML: <a href="http://server/path/?event=event&value=
2 - Source Type: Data Item Value - Data Item Value: COLUMN
3 - Source Type: text - HTML: " target="_blank">Link</a>
interestingly the XML source is now translated to nonsensical:
<HTMLItem>
<dataSource>
<staticValue><a href="http://server/path/?event=event&amp;value=</staticValue>
</dataSource>
</HTMLItem>
<HTMLItem>
<dataSource>
<dataItemValue refDataItem="COLUMN"/>
</dataSource>
</HTMLItem>
<HTMLItem>
<dataSource>
<staticValue>" target="_blank">Link</a></staticValue>
</dataSource>
</HTMLItem>
Yet the links from the Active Reports now works without issue.
Version: IBM Cognos Analytics 11.0.11