简体   繁体   English

pentaho cde表组件选择不同的数据源

[英]pentaho cde table component select diferent datasources

Good afternoon, I have a table in pentaho cde. 下午好,我在pentaho cde有一张桌子。 I want to know if there is any way of depending on a value of a parameter ($ {Author}), I want to be able to choose one query or another. 我想知道是否有任何方式取决于参数的值($ {Author}),我希望能够选择一个查询或另一个查询。 That is, I have a parameter ($ {Author}) that can have the value ' All' or many other values. 也就是说,我有一个参数($ {Author}),其值可以为'All'或许多其他值。 I have a query with the name 'PrincipalSql' and another 'SecundariaSql'. 我有一个名为“ PrincipalSql”和另一个“ SecundariaSql”的查询。 I want to know if there is a pentaho form of if $ {Author} = 'All' then sqlqueri = 'PrincipalSql' else sqlQuery = 'SecondarySql'. 我想知道是否有$ {Author} ='All'的pentaho形式,然后sqlqueri ='PrincipalSql'或sqlQuery ='SecondarySql'。 Thank you 谢谢

You can change that in the preExec method of the table component. 您可以在表组件的preExec方法中进行更改。 It's called before the component executes. 在组件执行之前调用它。

Just test the param value and change the component's chartDefinition.dataAccessId property. 只需测试参数值并更改组件的chartDefinition.dataAccessId属性。

Open the preExecution code editor (from advanced properties), and type something like this: 打开preExecution代码编辑器(从高级属性中),然后输入如下内容:

function(){
    var a = dashboard.getParameterValue("myParameter");
    if( a == "someValue"){
        this.chartDefinition.dataSource = "someQuery";
    }else{
        this.chartDefinition.dataSource = "someOtherQuery";
    }
    return true;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM