pentaho - 如何从 Pentaho 的图表中显示带有动态参数的报告?
问题描述
我的仪表板上有一个饼图,使用click action
,我设法显示具有一个固定参数的报告。这是我在点击操作上的 JS 函数:
function showreport(scene) {
var newWindow;
if(scene.getCategory()=='POS'){
newWindow=window.open("url_report?type_lm=POS", 'REPORT');
}else{
newWindow=window.open("url_report?type_lm=NEG", 'REPORT');
}
}
这个工作正常。但是现在我也想传递一个动态参数(使用 获得的变量query component
,它存储在result var
(code_lm)中:这是我所做的:
function showreport(scene) {
var newWindow;
var code_lm=this.dashboard.getParameterValue('code_lm');
if(scene.getCategory()=='POS'){
newWindow=window.open("url_report?type_lm=POS&code="+code_lm, 'REPORT');
}else{
newWindow=window.open("url_report?type_lm=NEG&code="+code_lm, 'REPORT');
}
}
这个不行,点击图表什么也没有显示。我发现这条线 var code_lm=this.dashboard.getParameterValue('code_lm');
导致了问题。
但是,我做同样的事情button component
:
function showreport() {
var code_lm=this.dashboard.getParameterValue('code_lm');
var newWindow = window.open("url_report?code=" + code_lm,'REPORT');
}
它工作得很好,所以我想知道为什么this.dashboard.getParameterValue()
在某些情况下不起作用。
谁能告诉我问题出在哪里?
解决方案
是的,如果你想从查询组件传递参数值,那么你需要通过在查询组件的post fetch中编写下面的代码来设置参数值。
function fun(code_lm) {
dashboard.setParam('yourParamName',code_lm.resultset);
}
看看这可能会对你有所帮助。如何将从查询组件获得的变量传递给 Pentaho CDE 上的查询?可以帮助你。
推荐阅读
- android - 如何在 Android 中创建 object.getClass() 方法的新对象?
- html - 无法嵌入 YouTube 以在我的网站上加载视频(按频道最新上传)
- java - 使用递归理解乘法
- laravel - Laravel 数据库通知未发送
- r - R - 如何在循环中改变一个函数来计算给定的单词并为每个单词添加一个新列
- rust - 是否可以匹配 clap 的 ArgMatches 类型?
- javascript - 是否可以破解 javascript 界面?
- raspberry-pi - libcurl4-openssl-dev :冲突:libssl1.0-dev 但要安装 1.0.2q-2
- c# - 在我的 Web api 端点中解析 HTTP POST 请求正文时出错
- python - passing optional arguments to a function in pandas