页面树结构
转至元数据结尾
转至元数据起始

示例说明
在组合分析中切换一个参数,不同的参数值打开不同的报表。如下图:
切换【报表】参数,值为1的时候显示报表1:

切换【报表】参数,值为2的时候显示报表2:

切换【报表】参数,值为3的时候显示报表3:

设置方法

  1. 在公共设置中,创建【报表】参数。
     
     
  2. 在资源定制中,创建报表1、报表2、报表3对应的数据集,要求所有数据集都需要在where条件中添加"报表参数"="报表参数",如下图:
  3. 在资源定制节点下使用上面数据集分别创建组合分析对于的报表1、报表2、报表3。
  4. 切换到 公共设置 >宏资源报 节点下,新建一个宏资源包,类型选择组合分析,适用范围选择报表1、报表2和报表3。
     
  5. 双击此宏资源包进入报表宏界面。
  6. 在报表宏界面新建客户端模块,在弹出的新建模块对话框中选择对象为simpleReport;事件为onParamValueChanged;并把下面宏代码复制到代码区域。 

宏类型

类型

对象

事件

ClientSide

simpleReport

onParamValueChanged

宏代码

function main(simpleReport, simpleReportContext, param) {
    var destQuery = null;
    if (param.name == "报表") {
        if (param.value == 1) destQuery = simpleReportContext.openQuery('I2c94eaaa2d83ab00012d9d3988341eb0');
        else if (param.value == 2) destQuery = simpleReportContext.openQuery('I2c94eaaa2d83ab00012d9d5fa1ce20af');
        else destQuery = simpleReportContext.openQuery('I2c94eaaa2d83ab00012d9d60026c20cb');
        realValue = param.value
        dispValue = realValue;
        if (realValue && dispValue) destQuery.fillParamValue('报表', realValue, dispValue);
        destQuery.refreshData();
        //--action end 
    }
}


关键对象总结

  • 目标报表填充参数对象:destQuery.fillParamValue('报表', realValue, dispValue);
  • 打开组合分析:simpleReportContext.openQuery("I2c949eaf1a942102011a9561f7e7015d");