COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: lskumar on 22 Nov 2012 04:38:12 AM

Title: How to select desired output using value prompt
Post by: lskumar on 22 Nov 2012 04:38:12 AM
Hi, I have a scenario where a value prompt is to be created for selecting desired output method for viewing the report i.e value prompt should contain pdf, html, excel , csv etc.. and when i select csv in prompt, the report should be displayed in csv mode.
Desperately need some help


Title: Re: How to select desired output using value prompt
Post by: HalfBloodPrince on 22 Nov 2012 04:52:53 AM
Drag HTML item from tool box on prompt page and put following code

<html>
<head>
<script language="javascript">
function gotoUrl()
{var obj=document.all['OutputFormat'];
/* Below function passed the selected output format to the server
*/
window.onload(gCognosViewer.getRV().viewReport(obj.options[obj.
selectedIndex].value));
}
</script>
</head>
<body>
<-- Below will create a dropdown with choices -->
<select name="OutputFormat" OnBlur="javascript:gotoUrl()">
<option value="HTML">HTML</option>
<option value="PDF">PDF</option>
<option value="singleXLS">Excel 2000 Single Sheet</option>
<option value="spreadsheetML">Excel 2007</option>
<option value="XLWA">Excel 2002</option>
<option value="XLS">Excel 2000</option>
<option value="CSV">Delimited text (CSV)</option>
<option value="XML">XML</option>
</select>
</body>
</html>
Title: Re: How to select desired output using value prompt
Post by: lskumar on 22 Nov 2012 11:20:55 PM
Thanks a lot. You saved my day.
Title: Re: How to select desired output using value prompt
Post by: Lynn on 27 Nov 2012 07:57:16 AM
The attached document describes an approach to prompt for output format without using Java Script. Sometimes Java Script can break when upgrading so I try to avoid it when there are other methods available to achieve the requirement.