[转载]Cognos Report Studio默认参数
(2012-02-17 14:09:16)
标签:
转载 |
分类: BICognos |
【ZT:http://wengr.blog.163.com】
Cognos Report Studio默认参数传递设计案例
编者:wengr
简述
在Cognos报表设计中,参数传递有很多种:第一种是:在钻取时,把当前参数值传递给指定接收报表,接收报表参数类型与传递报表参数类型必须一致;第二种是:在其他页面嵌套Cognos报表链接地址,在地址之后追加参数配置,达到参数接收;第三种是:在提示页做好预处理,利用HTML、JS语言编程。
下面针对第三种情况,进行解说,怎样才能达到默认值传递。一般来说,报表默认值都是针对日期而设置,取当前最近值。
日期JS表达式定义
表达式内容如下:init()定义一个函数
|
<script
type="text/javas function init() { document.forms["formWarpRequest_NS_"]._oLstChoicesMyPrompt[document.forms["formWarpRequest_NS_"]._oLstChoicesMyPrompt.length-1].selected = "true"; promptButtonFinish(); } </script>
<body
on |
MyPrompt 为值提示下拉框对象,在局部使用都是唯一名称。
MyPrompt.length-1
提示控件配置
通过图,可以看出设置思路。(图略)
多个默认参数配置
如日期对象为:MyPrompt
|
<script
type="text/javas function init() { document.forms["formWarpRequest_NS_"]._oLstChoicesMMPrompt[document.forms["formWarpRequest_NS_"]._oLstChoicesMMPrompt.length-1].selected = "true"; promptButtonFinish(); } </script>
<body
on |
对不同的参数取第一默认值,可以事先在建查询设置好,按照需求业务对成员进行排序,提示值只有运行报表时才用到,之后的参数接收都是在报表页面选项中完成,在提示页下拉框完全可以独立创建查询,内容可以是一个或者两个以上,即可。
或者在同一个HTML脚本增加两个控件获取代码:
|
<script
type="text/javas function init() { document.forms["formWarpRequest_NS_"]._oLstChoicesMyPrompt[document.forms["formWarpRequest_NS_"]._oLstChoicesMyPrompt.length-1].selected = "true"; document.forms["formWarpRequest_NS_"]._oLstChoicesMMPrompt[document.forms["formWarpRequest_NS_"]._oLstChoicesMMPrompt.length-1].selected = "true"; document.forms["formWarpRequest_NS_"]._oLstChoicesMGPrompt[3].selected = "true"; promptButtonFinish(); } </script>
<body
on |
以上是三段代码,控制不同的控件。对控件代码进行说明:
document.forms["formWarpRequest_NS_"]._oLstChoicesMGPrompt[3].selected = "true",是针对固定查询项目,如用户属性,客户等级等维度成员基本保持不变,方便控制。
document.forms["formWarpRequest_NS_"]._oLstChoicesMyPrompt[document.forms["formWarpRequest_NS_"]._oLstChoicesMyPrompt.length-1].selected = "true";
适合做动态维度成员,根据权限判断成员变化,再指定一个默认成员,根据排序确定。
附加:
Cognos怎样去掉value prompt前两项的方法:javas
|
<script
language="javas
function remove2line(obj){
} </script> |
在Report
Studio开发界面,增加HTML项目添加到下拉控件,编辑javas
注意:
本方法我个人不推荐使用,仅供参考。有一个问题存在,当你多次选择提交后,value prompt前两项还是会出现。对于小数据量的报表,在3秒种内刷出数据,就不会出现这种情况。但可以结合以上JS代码完善提示页参数传值,更好解决日期参数传值:
|
<meta HTTP-EQUIV="pragma"
CONTENT="no-cache">
<script
language="javas
function remove2line(obj){
} promptButtonFinish(); </script> |

加载中…