COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: isap on 10 May 2011 06:07:34 AM

Title: Screen resoltuion for cognos 10.1 reports
Post by: isap on 10 May 2011 06:07:34 AM
Hi All,
This might not be a correct question but if the experts could answer - will be much appreciated. So my users are switching between opening reports (report studio) on their laptops or projectors for presentation purposes. They run into the screen resolution issues and endless scrolling when they are switched to different resolutions. Is it possible that cognos could identify the screen on which it is opened and behave appropriately? Thanks a ton for all the responses.
Title: Re: Screen resoltuion for cognos 10.1 reports
Post by: MFGF on 12 May 2011 04:28:57 AM
There is no inherent intelligence in the product to determine resolution, sorry.  One option is to build all reports to suit the lowest resolution you will need - this is generally the approach I take.

I guess it might be possible to add code into reports as HTML items to interactively make changes, but it's not something I've ever done (or even thought of doing), so I will leave comenting on that to the many impressive javascript/jquery experts we have on here. :)

Regards,

MF.
Title: Re: Screen resoltuion for cognos 10.1 reports
Post by: Arpitagrawal9 on 14 Jun 2011 07:11:24 AM
Hi,

This can be achieved using JavaScript. You just need to add a script at the end of the report. This script gets the current screen resolution and sets the size of webpage according to that.
Title: Re: Screen resoltuion for cognos 10.1 reports
Post by: isap on 14 Jun 2011 08:22:05 AM
Arpit,
Thnks for your response. I am no programmer. Do you have a sample script or any suitable example? Would appreciate your effort.

Cheers
Title: Re: Screen resoltuion for cognos 10.1 reports
Post by: Arpitagrawal9 on 14 Jun 2011 10:18:57 AM
Hi,

Well i have a sample Script which i used to develop a report for one of my client

function setPageSize(eventType)
{
//alert(document.getElementById("xxx").parentNode.parentNode.parentNode.parentNode.style.height);
//alert(document.getElementById("xxx").parentNode.parentNode.parentNode.parentNode.nodeName);
var mainSiteDiv = document.getElementById('mainsitediv');
var listDiv=document.getElementById('listDiv');
   if(document.body.clientHeight && document.body.clientHeight>250)
   {
      height=document.body.clientHeight;
   }
   else if(document.documentElement.clientHeight && document.documentElement.clientHeight>250)
   {
      height=document.documentElement.clientHeight;
   }
   else
   {
      height=475;
   }
document.getElementById("xxx").parentNode.style.height=height-10;
document.getElementById("xxx").parentNode.parentNode.parentNode.parentNode.style.height=height-10;
//alert(height);
//alert(document.getElementById("xxx").parentNode.style.height);
height=height-250;
   listDiv.firstChild.style.height=height;

}

&lt;/script&gt;</staticValue>
         </dataSource>
      </HTMLItem><HTMLItem description="Save/Read Site cookie" name="Save/Read Site cookie1">
         <dataSource>
            <staticValue>&lt;script type="text/javascript"&gt;

}


Try using this Javascript and let me know in case you still face any issue.

Hope this helps
Title: Re: Screen resoltuion for cognos 10.1 reports
Post by: isap on 15 Jun 2011 03:12:36 AM
Thanks, Arpit. I really appreciate it. Will get back to you incase I stumble.


Cheers
Title: Re: Screen resoltuion for cognos 10.1 reports
Post by: salcg on 17 Jun 2011 09:47:23 AM
Hi Arpit,
I have a dashboard in Cognos 8, which is basically a page with six reports on it. (I'm not using Go Dashboard).

If I have to add this code to my dashboard, where would I add it?

Please advise.

Thanks!
Title: Re: Screen resoltuion for cognos 10.1 reports
Post by: sujitgouda on 16 Jun 2014 03:30:36 PM
Can we make use of it on Cognos Business Insight ?
Title: Re: Screen resoltuion for cognos 10.1 reports
Post by: sakthivelmani on 13 Oct 2014 09:19:28 PM
Hi Arpit,

Thanks for the Java script. I have a cognos dashboard (page ) with four cognos viewers. Where should i add this script ? Should i add this to every single report ? Please help

Thanks,
Sakthi
Title: Re: Screen resoltuion for cognos 10.1 reports
Post by: Arpitagrawal9 on 13 Oct 2014 09:36:52 PM
Hi Shakti,

You should add this at the end of the dashboard using the HTML Tag

Cheers,
Arpit
Title: Re: Screen resoltuion for cognos 10.1 reports
Post by: sakthivelmani on 14 Oct 2014 07:54:40 AM
Thanks, Arpit. I will try this.
Title: Re: Screen resoltuion for cognos 10.1 reports
Post by: xyz on 16 Sep 2015 02:27:35 AM
Hi Arpit,

Below code when I tried to paste in the HTML item and placed after the list report in cognos report studio.
It seem's script is not working, we enclosed the script in script tags even though, it is not working, we are using Cognos 10.2.2

In the below java script code, unable to understand the below part, looks like "<" symbol is replaced with '&lt;', even thought the tags are getting closed first and then the code is written after it.

&lt;/script&gt;</staticValue>
         </dataSource>
      </HTMLItem><HTMLItem description="Save/Read Site cookie" name="Save/Read Site cookie1">
         <dataSource>
            <staticValue>&lt;script type="text/javascript"&gt;

Can you please let us know, if you have any solution.


Thanks & Regards,
XYZ