提示:本文档的示例代码仅适用于本文档中的示例报表/场景。若实际报表/场景与示例代码无法完全适配(如使用功能不一致,或多个宏代码冲突等),需根据实际需求开发代码。 |
示例说明
在组合分析中切换一个参数,不同的参数值打开不同的报表。如下图:
切换【报表】参数,值为1的时候显示报表1:
切换【报表】参数,值为2的时候显示报表2:
切换【报表】参数,值为3的时候显示报表3:
设置方法
宏类型
类型 | 对象 | 事件 |
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 } } |
关键对象总结