我需要在显示屏上显示cognos报告,并且报告需要在给定的时间间隔内刷新。
1)一份关于cognos报告的内容有6页,我需要一个接一个地显示所有六个页面,它应该转到下一个报告,并且以同样的方式显示所有页面在所有报告中。
目前我正在使用iframe来显示多个认知报告,但是显示停止是我无法显示认知报告的所有页面,因为它只显示报告的第一页。
脚本显示多个认知报告。
<script type="text/javascript">
var slideimages = new Array();
slideimages[0] = "http://COGDEVWEB1:80/ibmcognos/cgi-bin/cognosisapi.dll?b_action=cognosViewer&ui.action=run&ui.object=CAMID(%22dcanalyze%3au%3aa202da3d8b73bb4b954d583834a025a5%22)%2ffolder%5b%40name%3d%27My%20Folders%27%5d%2ffolder%5b%40name%3d%27Anil%27%5d%2ffolder%5b%40name%3d%27On%20Screen%20Testing%27%5d%2ffolder%5b%40name%3d%27BRACKENFELL%20SCHEDULES%27%5d%2ffolder%5b%40name%3d%27ON%20SCREEN%20DISPLAYS%27%5d%2ffolder%5b%40name%3d%27SCOREBOARD%20SCHEDULES%2007%3a00%20-%2019%3a00%27%5d%2freport%5b%40name%3d%27BRACKENFELL%20DC%20-%201ST%20PAGE%27%5d&ui.name=BRACKENFELL%20DC%20-%201ST%20PAGE&run.outputFormat=&run.prompt=true";
slideimages[1] = "http://COGDEVWEB1:80/ibmcognos/cgi-bin/cognosisapi.dll?b_action=cognosViewer&ui.action=run&ui.object=CAMID(%22dcanalyze%3au%3aa202da3d8b73bb4b954d583834a025a5%22)%2ffolder%5b%40name%3d%27My%20Folders%27%5d%2ffolder%5b%40name%3d%27Anil%27%5d%2ffolder%5b%40name%3d%27On%20Screen%20Testing%27%5d%2ffolder%5b%40name%3d%27BRACKENFELL%20SCHEDULES%27%5d%2ffolder%5b%40name%3d%27ON%20SCREEN%20DISPLAYS%27%5d%2ffolder%5b%40name%3d%27SCOREBOARD%20SCHEDULES%2007%3a00%20-%2019%3a00%27%5d%2freport%5b%40name%3d%27BRACKENFELL%20DC%20-%20FULL%20CASE%20PICKER%20SHIFT%201%27%5d&ui.name=BRACKENFELL%20DC%20-%20FULL%20CASE%20PICKER%20SHIFT%201&run.outputFormat=HTML&run.prompt=true";
slideimages[2] = "http://COGDEVWEB1:80/ibmcognos/cgi-bin/cognosisapi.dll?b_action=cognosViewer&ui.action=run&ui.object=CAMID(%22dcanalyze%3au%3aa202da3d8b73bb4b954d583834a025a5%22)%2ffolder%5b%40name%3d%27My%20Folders%27%5d%2ffolder%5b%40name%3d%27Anil%27%5d%2ffolder%5b%40name%3d%27On%20Screen%20Testing%27%5d%2ffolder%5b%40name%3d%27BRACKENFELL%20SCHEDULES%27%5d%2ffolder%5b%40name%3d%27ON%20SCREEN%20DISPLAYS%27%5d%2ffolder%5b%40name%3d%27SCOREBOARD%20SCHEDULES%2007%3a00%20-%2019%3a00%27%5d%2freport%5b%40name%3d%27BRACKENFELL%20DC%20-%20FULL%20CASE%20PICKER%20SHIFT%202%27%5d&ui.name=BRACKENFELL%20DC%20-%20FULL%20CASE%20PICKER%20SHIFT%202&run.outputFormat=HTML&run.prompt=true";
slideimages[3] = "http://COGDEVWEB1:80/ibmcognos/cgi-bin/cognosisapi.dll?b_action=cognosViewer&ui.action=run&ui.object=CAMID(%22dcanalyze%3au%3aa202da3d8b73bb4b954d583834a025a5%22)%2ffolder%5b%40name%3d%27My%20Folders%27%5d%2ffolder%5b%40name%3d%27Anil%27%5d%2ffolder%5b%40name%3d%27On%20Screen%20Testing%27%5d%2ffolder%5b%40name%3d%27BRACKENFELL%20SCHEDULES%27%5d%2ffolder%5b%40name%3d%27ON%20SCREEN%20DISPLAYS%27%5d%2ffolder%5b%40name%3d%27SCOREBOARD%20SCHEDULES%2007%3a00%20-%2019%3a00%27%5d%2freport%5b%40name%3d%27BRACKENFELL%20DC%20-%20INDIRECT%20SHIFT%27%5d&ui.name=BRACKENFELL%20DC%20-%20INDIRECT%20SHIFT&run.outputFormat=HTML&run.prompt=true";
slideimages[4] = "http://COGDEVWEB1:80/ibmcognos/cgi-bin/cognosisapi.dll?b_action=cognosViewer&ui.action=run&ui.object=CAMID(%22dcanalyze%3au%3aa202da3d8b73bb4b954d583834a025a5%22)%2ffolder%5b%40name%3d%27My%20Folders%27%5d%2ffolder%5b%40name%3d%27Anil%27%5d%2ffolder%5b%40name%3d%27On%20Screen%20Testing%27%5d%2ffolder%5b%40name%3d%27BRACKENFELL%20SCHEDULES%27%5d%2ffolder%5b%40name%3d%27ON%20SCREEN%20DISPLAYS%27%5d%2ffolder%5b%40name%3d%27SCOREBOARD%20SCHEDULES%2007%3a00%20-%2019%3a00%27%5d%2freport%5b%40name%3d%27BRACKENFELL%20DC%20-%20LATE%20PICKS%20SCOREBOARD%27%5d&ui.name=BRACKENFELL%20DC%20-%20LATE%20PICKS%20SCOREBOARD&run.outputFormat=HTML&run.prompt=true";
slideimages[5] = "http://COGDEVWEB1:80/ibmcognos/cgi-bin/cognosisapi.dll?b_action=cognosViewer&ui.action=run&ui.object=CAMID(%22dcanalyze%3au%3aa202da3d8b73bb4b954d583834a025a5%22)%2ffolder%5b%40name%3d%27My%20Folders%27%5d%2ffolder%5b%40name%3d%27Anil%27%5d%2ffolder%5b%40name%3d%27On%20Screen%20Testing%27%5d%2ffolder%5b%40name%3d%27BRACKENFELL%20SCHEDULES%27%5d%2ffolder%5b%40name%3d%27ON%20SCREEN%20DISPLAYS%27%5d%2ffolder%5b%40name%3d%27SCOREBOARD%20SCHEDULES%2007%3a00%20-%2019%3a00%27%5d%2freport%5b%40name%3d%27BRACKENFELL%20DC%20-%20LOCAL%20ROUTES%20REMAINING%20CASES%20TO%20PICK%27%5d&ui.name=BRACKENFELL%20DC%20-%20LOCAL%20ROUTES%20REMAINING%20CASES%20TO%20PICK&run.outputFormat=HTML&run.prompt=true";
slideimages[6] = "http://COGDEVWEB1:80/ibmcognos/cgi-bin/cognosisapi.dll?b_action=cognosViewer&ui.action=run&ui.object=CAMID(%22dcanalyze%3au%3aa202da3d8b73bb4b954d583834a025a5%22)%2ffolder%5b%40name%3d%27My%20Folders%27%5d%2ffolder%5b%40name%3d%27Anil%27%5d%2ffolder%5b%40name%3d%27On%20Screen%20Testing%27%5d%2ffolder%5b%40name%3d%27BRACKENFELL%20SCHEDULES%27%5d%2ffolder%5b%40name%3d%27ON%20SCREEN%20DISPLAYS%27%5d%2ffolder%5b%40name%3d%27SCOREBOARD%20SCHEDULES%2007%3a00%20-%2019%3a00%27%5d%2freport%5b%40name%3d%27BRACKENFELL%20DC%20-%20LOCAL%20ROUTES%20REMAINING%20LETDOWNS%27%5d&ui.name=BRACKENFELL%20DC%20-%20LOCAL%20ROUTES%20REMAINING%20LETDOWNS&run.outputFormat=HTML&run.prompt=true";
slideimages[7] = "http://COGDEVWEB1:80/ibmcognos/cgi-bin/cognosisapi.dll?b_action=cognosViewer&ui.action=run&ui.object=CAMID(%22dcanalyze%3au%3aa202da3d8b73bb4b954d583834a025a5%22)%2ffolder%5b%40name%3d%27My%20Folders%27%5d%2ffolder%5b%40name%3d%27Anil%27%5d%2ffolder%5b%40name%3d%27On%20Screen%20Testing%27%5d%2ffolder%5b%40name%3d%27BRACKENFELL%20SCHEDULES%27%5d%2ffolder%5b%40name%3d%27ON%20SCREEN%20DISPLAYS%27%5d%2ffolder%5b%40name%3d%27SCOREBOARD%20SCHEDULES%2007%3a00%20-%2019%3a00%27%5d%2freport%5b%40name%3d%27BRACKENFELL%20DC%20-%20LOCAL%20ROUTES%20REPICKS%20PENDING%27%5d&ui.name=BRACKENFELL%20DC%20-%20LOCAL%20ROUTES%20REPICKS%20PENDING&run.outputFormat=HTML&run.prompt=true";
slideimages[8] = "http://COGDEVWEB1:80/ibmcognos/cgi-bin/cognosisapi.dll?b_action=cognosViewer&ui.action=run&ui.object=CAMID(%22dcanalyze%3au%3aa202da3d8b73bb4b954d583834a025a5%22)%2ffolder%5b%40name%3d%27My%20Folders%27%5d%2ffolder%5b%40name%3d%27Anil%27%5d%2ffolder%5b%40name%3d%27On%20Screen%20Testing%27%5d%2ffolder%5b%40name%3d%27BRACKENFELL%20SCHEDULES%27%5d%2ffolder%5b%40name%3d%27ON%20SCREEN%20DISPLAYS%27%5d%2ffolder%5b%40name%3d%27SCOREBOARD%20SCHEDULES%2007%3a00%20-%2019%3a00%27%5d%2freport%5b%40name%3d%27BRACKENFELL%20DC%20-%20MEZZANINE%20SHIFT%27%5d&ui.name=BRACKENFELL%20DC%20-%20MEZZANINE%20SHIFT&run.outputFormat=HTML&run.prompt=true";
slideimages[9] = "http://COGDEVWEB1:80/ibmcognos/cgi-bin/cognosisapi.dll?b_action=cognosViewer&ui.action=run&ui.object=CAMID(%22dcanalyze%3au%3aa202da3d8b73bb4b954d583834a025a5%22)%2ffolder%5b%40name%3d%27My%20Folders%27%5d%2ffolder%5b%40name%3d%27Anil%27%5d%2ffolder%5b%40name%3d%27On%20Screen%20Testing%27%5d%2ffolder%5b%40name%3d%27BRACKENFELL%20SCHEDULES%27%5d%2ffolder%5b%40name%3d%27ON%20SCREEN%20DISPLAYS%27%5d%2ffolder%5b%40name%3d%27SCOREBOARD%20SCHEDULES%2007%3a00%20-%2019%3a00%27%5d%2freport%5b%40name%3d%27BRACKENFELL%20DC%20-%20SECTION%20AND%20REPORT%20GROUP%20SUMMARY%27%5d&ui.name=BRACKENFELL%20DC%20-%20SECTION%20AND%20REPORT%20GROUP%20SUMMARY&run.outputFormat=HTML&run.prompt=true";
slideimages[10] = "http://COGDEVWEB1:80/ibmcognos/cgi-bin/cognosisapi.dll?b_action=cognosViewer&ui.action=run&ui.object=CAMID(%22dcanalyze%3au%3aa202da3d8b73bb4b954d583834a025a5%22)%2ffolder%5b%40name%3d%27My%20Folders%27%5d%2ffolder%5b%40name%3d%27Anil%27%5d%2ffolder%5b%40name%3d%27On%20Screen%20Testing%27%5d%2ffolder%5b%40name%3d%27BRACKENFELL%20SCHEDULES%27%5d%2ffolder%5b%40name%3d%27ON%20SCREEN%20DISPLAYS%27%5d%2ffolder%5b%40name%3d%27SCOREBOARD%20SCHEDULES%2007%3a00%20-%2019%3a00%27%5d%2freport%5b%40name%3d%27BRACKENFELL%20DC%20-%20TOWER%20SHIFT%27%5d&ui.name=BRACKENFELL%20DC%20-%20TOWER%20SHIFT&run.outputFormat=HTML&run.prompt=true";
// style="border: 0; width: 100%; height: 100%" frameborder="0"
// style="border: 0; width: 100%; height: 100%" frameborder="0" scrolling="no" onload="resizeIframe(this)"
</script>
</head>
身体 { 保证金:0; 溢出:隐藏; }
#iframe1
{
height: 100%;
left: 0px;
position: absolute;
top: 0px;
width: 100%;
}
</style>
<body>
<iframe id="slide" src="" frameborder="0" style="height: 100%; width: 100%; position: absolute;" height="100%" width="100%" ></iframe>
<script type="text/javascript">
var step=0
function slideit(){
document.getElementById('slide').src = slideimages[step]
if (step<slideimages.length-1)
step++
else
step=0
setTimeout("slideit()",20000)
}
slideit()
</script>
</body>
任何人都可以帮我解决问题。
亲切的问候, Anil R G
答案 0 :(得分:0)
这是通过JavaScript和Cognos JS API前进到下一页的方式:
var report = cognos.Report.getReport('_THIS_');
report.sendRequest(cognos.Report.Action.NEXT);
API在Cognos BI 10.2及更高版本中提供。
我会在每个目标报告中创建一个函数,如下所示:
function navigate(action) {
var report = cognos.Report.getReport('_THIS_');
report.sendRequest(action);
}
然后我从主代码中调用该函数:
var iframe = document.getElementById('slide');
iframe.navigate(cognos.Report.Action.NEXT);
这会将当前iFrame中的报告推进一页。
挑战来自于遍历页面。您必须知道每个报告以某种方式有多少页面。如果报告有固定的,已知的页数则没问题。我创建了一个对象数组来存储源和页面数:
var reports = [];
reports.push(new Report('http://COGDEVWEB1:80/ibmcognos/cgi-bin/cognosisapi.dll?b_action=cognosViewer&ui.action=run&ui.object=CAMID(%22dcanalyze%3au%3aa202da3d8b73bb4b954d583834a025a5%22)%2ffolder%5b%40name%3d%27My%20Folders%27%5d%2ffolder%5b%40name%3d%27Anil%27%5d%2ffolder%5b%40name%3d%27On%20Screen%20Testing%27%5d%2ffolder%5b%40name%3d%27BRACKENFELL%20SCHEDULES%27%5d%2ffolder%5b%40name%3d%27ON%20SCREEN%20DISPLAYS%27%5d%2ffolder%5b%40name%3d%27SCOREBOARD%20SCHEDULES%2007%3a00%20-%2019%3a00%27%5d%2freport%5b%40name%3d%27BRACKENFELL%20DC%20-%201ST%20PAGE%27%5d&ui.name=BRACKENFELL%20DC%20-%201ST%20PAGE&run.outputFormat=&run.prompt=true',4));
reports.push(new Report('http://COGDEVWEB1:80/ibmcognos/cgi-bin/cognosisapi.dll?b_action=cognosViewer&ui.action=run&ui.object=CAMID(%22dcanalyze%3au%3aa202da3d8b73bb4b954d583834a025a5%22)%2ffolder%5b%40name%3d%27My%20Folders%27%5d%2ffolder%5b%40name%3d%27Anil%27%5d%2ffolder%5b%40name%3d%27On%20Screen%20Testing%27%5d%2ffolder%5b%40name%3d%27BRACKENFELL%20SCHEDULES%27%5d%2ffolder%5b%40name%3d%27ON%20SCREEN%20DISPLAYS%27%5d%2ffolder%5b%40name%3d%27SCOREBOARD%20SCHEDULES%2007%3a00%20-%2019%3a00%27%5d%2freport%5b%40name%3d%27BRACKENFELL%20DC%20-%20FULL%20CASE%20PICKER%20SHIFT%201%27%5d&ui.name=BRACKENFELL%20DC%20-%20FULL%20CASE%20PICKER%20SHIFT%201&run.outputFormat=HTML&run.prompt=true',9));
...
function Report (src,pagecount) {
this.src = src;
this.pagecount = pagecount;
this.currentpage = 1;
this.advanceCount = function () {
if (this.currentpage == this.pagecount) {
this.currentpage = 1;
} else {
this.currentpage++;
}
}
}
然后,您可以遍历报表数组,像以前一样更改源,然后使用当前实例的currentpage和pagecount来确定推进页面的次数。你调用iframe.navigate(cognos.Report.Action.NEXT);正确的次数并在报表对象上调用advanceCount()来增加页面计数器。
作为参考,您可以传递给navigate()函数的所有操作如下:
cognos.Report.Action.NEXT
cognos.Report.Action.BACK
cognos.Report.Action.REPROMPT
cognos.Report.Action.CANCEL
cognos.Report.Action.FINISH