COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Cptkwik on 29 Jun 2017 06:56:55 AM

Title: ReportOption() - Hide Drill-Through link when report is emailed
Post by: Cptkwik on 29 Jun 2017 06:56:55 AM
All
I have a requirement to modify a report meant to be viewed in HTML format while in Cognos 10 that has multiple drill-through links embedded within a list to various supporting reports. The requirement is to hide/switch - by use of conditional block and a Boolean block variable - between the hyperlink and plain text if the report is viewed outside of HTML format (ie not XLs or PDF) or if the email report option is used. I have created a Boolean Variable but am having some issues combining the two function selected in the Expression Definition field as I have never combined multiple functions in the same condition.
My attempt: 
ReportOutput() in ('HTML')
and not
(ReportOption ('email')=1 or ReportOption('burst')=1)

But I cannot get this to work. Any advice help is appreciated as IBM's documentation sucks.
Title: Re: ReportOption() - Hide Drill-Through link when report is emailed
Post by: New_Guy on 29 Jun 2017 07:04:06 AM
Hi,
You can use reportoutput() in ('HTML') and assign it to the Drill through link text and reportoutput() not in ('HTML') for the plain text. Try if this helps.
Good luck
New guy
Title: Re: ReportOption() - Hide Drill-Through link when report is emailed
Post by: Cptkwik on 29 Jun 2017 07:13:53 AM
Thanks I will try that, but the complication comes when that same HTML report is emailed to users. The emailed HTML report is embedded in the email and my client does not want people to think they can or try to access the report through email. I need to hide the link and replace it with plain text when emailing any file type.
Title: Re: ReportOption() - Hide Drill-Through link when report is emailed
Post by: New_Guy on 29 Jun 2017 08:11:52 AM
Hi,
Use a style variable and do the box type none. Below is the xml of a sample report. Try it.
<report xmlns="http://developer.cognos.com/schemas/report/12.0/" useStyleVersion="10" expressionLocale="en-us">
<modelPath>/content/folder[@name='xxxx']/package[@name='xxxx']/model[@name='model']</modelPath>
<drillBehavior modelBasedDrillThru="true"/>
<layouts>
<layout>
<reportPages>
<page name="Page1">
<style>
<defaultStyles>
<defaultStyle refStyle="pg"/>
</defaultStyles>
</style>
<pageBody>
<style>
<defaultStyles>
<defaultStyle refStyle="pb"/>
</defaultStyles>
</style>
<contents><textItem><dataSource><staticValue>HTML Interactive</staticValue></dataSource><conditionalStyles><conditionalStyleCases refVariable="HTML"><conditionalStyle refVariableValue="1"><CSS value="display:none"/></conditionalStyle></conditionalStyleCases><conditionalStyleDefault/></conditionalStyles></textItem><textItem><dataSource><staticValue>HTML Email</staticValue></dataSource><conditionalStyles><conditionalStyleCases refVariable="HTML"><conditionalStyle refVariableValue="1"/></conditionalStyleCases><conditionalStyleDefault><CSS value="display:none"/></conditionalStyleDefault></conditionalStyles></textItem></contents>
</pageBody>
</page>
</reportPages>
</layout>
</layouts>
<XMLAttributes><XMLAttribute name="RS_CreateExtendedDataItems" value="true" output="no"/><XMLAttribute name="listSeparator" value="," output="no"/><XMLAttribute name="RS_modelModificationTime" value="2017-06-28T14:15:34.124Z" output="no"/></XMLAttributes><reportVariables><reportVariable type="boolean" name="HTML">
<reportExpression>ReportOption('emailAsAttachment')</reportExpression>
<variableValues>
<variableValue value="1"/>
</variableValues>
</reportVariable></reportVariables><reportName>Test</reportName></report>


Good luck
New guy
Title: Re: ReportOption() - Hide Drill-Through link when report is emailed
Post by: Cptkwik on 29 Jun 2017 09:23:41 AM
Thanks to the members who responded so quickly. Talked with colleague and he pointed out that my original script did not include single quotes for the ReportOption function compare. eg I had ReportOption('email')=1 when I should have wrapped the one in single quotes as it the return value is a String.
The following Expression Definition works correctly:
if (
ReportOutput() in ('HTML')
and not
(ReportOption ('email')='1' or ReportOption('burst')='1')
)
then (1)
else (0)