Hello Cognos User's,
I have one list report and one value prompt page. When I select PDF in prompt the report will show in PDF format and when I select HTML then report will show in HTML format.
How do I achieve this?
Thanks,
jack.
Here is a document I wrote on using a drill through technique for output format prompting. It isn't really a prompt at all, but rather a drill through link on the prompt page back to the same report.
I think someone might have posted a java script approach for this somewhere, but I generally avoid JS where an out of the box solution is possible.
Quote from: jack082 on 21 Dec 2010 05:49:32 AM
Hello Cognos User's,
I have one list report and one value prompt page. When I select PDF in prompt the report will show in PDF format and when I select HTML then report will show in HTML format.
How do I achieve this?
Thanks,
jack.
Hi Jack,
It is not that much tedious thing to use JavaScript in our reports,
Here I'm sending some script which will give you a set of choices to get the out put based on the section from choices
Here it goes,
1. Open the report in Report Studio.
2. Add a new prompt page to the report from Page Explorer.
3. Open the prompt page and insert a new HTML item in the page body.
4. Define the HTML item as follows:
<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>
<-- Bellow will not required most of times -->
<option value="CSV">Delimited text (CSV)</option>
<option value="XML">XML</option>
</select>
</body>
</html>
5. Run the report to test it.
Note: Instead of giving all the formats as option, you can narrow it down to only HTML, PDF, and Excel. Alternatively, you can also put a checkbox for 'Printable' and if the user selects it, pass the value as PDF or otherwise HTML.
Hi, I'm a real beginner with report studio and java. You script works perfectly. Is it possible to wrap this around a set of radio buttons and get the selection choice from there? Or does this have to stay as a drop down list?
Thanks much.
hi jack ,
dont fell its a very simple one.u can do it easily.no need java or HTML just Follow the simple Steps.
1st step:-
>create a report with any data items
eg:product line,product type,revenue
>save that report
2nd step:-
>open saved report
>go to page explorer,create new prompt page
>from insertable objects pane drag a text item into prompt page,enter text as 'PDF' in that text item
>Drag another text item into that same prompt page enter text as 'HTML' in that tex item
>do the same process to all formats like excel,csv,xml etc......
3rd step
>then right click on first text item 'PDF' then click on drillthrough Defination
>drill through window will open
>click on new new drill through button in drill through window.
>under target tab
>click on report then select saved report(means the report which you saved in 1st step) click ok
>under actions change action to 'run report'
>under format change format to 'PDF' .click ok
>next again go to prompt page ,right click on 'HTML' text item click on drill through defination
>drill through window will open
>click on new new drill through button in drill through window.
>under target tab
>click on report then select saved report(means the report which you saved in 1st step) click ok
>under actions change action to 'run report'
>under format change format to 'HTML' .click ok
>repeat same process to all Excel,csv,xml,html text items which you created before in prompt page.
>but under format change format to respected text items.
eg:: for excel dat item ----- change format to 'excel'
for to xml dat item ----- change format to ' xml'
for to csv dat item ----- change format to 'csv'
it is very easy method.no need to use java or HTML.hope u understand ???
Hi Jack,
Please find the solution as explained in my website sourcetofind.
Really? You think he is still looking for a solution four years later, or are you just trying to generate clicks to your website?
If you want to offer a solution, it belongs in a post right here.
Quote from: bdbits on 08 Apr 2015 09:10:11 AM
Really? You think he is still looking for a solution four years later, or are you just trying to generate clicks to your website?
If you want to offer a solution, it belongs in a post right here.
I agree! If someone is referring to another site with an answer it should be a link to a specific location where that answer can be found so as not to make the person wander around aimlessly trying to find it.
Hi Ravi,
Your blog is interesting and has some good content. But I agree with Lynn & bdbits that you should probably go about this a bit differently. How about introducing yourself on the Cognoise board 'Introduce yourself and your company':
http://www.cognoise.com/index.php/board,30.0.html (http://www.cognoise.com/index.php/board,30.0.html) ?
I'm sure you will be welcomed there :)
Rgds, Michael