Sunday, 19 October 2014

Export Cognos report into Excel & PDF using Buttons

    Export Cognos Report into Excel & PDF using Buttons


Requirment: Export Cognos report in to Excel/PDF if cognos toolbar is hidden, without using default functionality.

Solution: This can be done using drill through functionality.


Insert a Prompt Button in your report, make it Finish type and edit the text with “Export to Excel”.


Click “Export to Excel” text and select Drill through definitions.



In drill through definitions select the same parent report as the target report and change the Format to “Excel 2007”.



In case you have some parameters defined then set the Parameters value also for drill through.
Click ok and do the appropriate formatting of Button accordingly.


Similarly you can create Button for Export to PDF.
For PDF outputs just change the format to PDF.

------------------------END------------------------------------

Thursday, 16 October 2014

Hide Cognos Toolbar Using Java Script

Hide Default Cognos Toolbar


Requirement: Hide the default Cognos Toolbar.

Solution : Using HTML scripting we can hide this toolbar.

HTML: 

Insert a HTML Item in the report header.
Copy the below mentioned code and paste it into the HTML Item.

<script type="text/javascript">
var tables = document.getElementsByTagName("table");
var tds = document.getElementsByTagName("td");

for (var i=0;i<tds.length;i++){
if(tds[i].id.indexOf("CVToolbar") == 0){
tds[i].style.display = 'none';
}
}
</script>

---------------------------------------------------End ------------------------------------------------------------------------

Wednesday, 15 October 2014

Render Crosstab Report Columns Using Value Prompt



Show and Hide Crosstab Report Columns based on Value Prompt


Requirement: Hide and show crosstab columns based on multi select value prompt.
Solution:
Create a crosstab report with multiple columns say A, B, C &D, row as E and a measure X.
Now drag a value prompt and click Finish.


Make it Multi Select and Check Box.

 
Define the static choices for the prompt say A, B, C & D.

 

Now go the report query and open the data item A.
Write the CASE statement.
if(A in (#promptmany('P_PromptName','token','[A]')#)) then ([A]) else null
Similarly edit all the remaining columns.
if(B in (#promptmany('P_PromptName','token','[B]')#)) then ([B]) else null
Now go to the report page select Crosstab and from the properties Pane Click Suppression.

 
Apply suppression for Columns only.