2013-12-17 103 views
1

我使用了pentaho CE biserver-ce-4.8.0稳定版。我想创建一个从mongodb获取数据的仪表板,所以我创建了ktr文件在数据集成中与mongodb进行通信并从mongodb获取数据。从那以后,我使用.ktr文件在我的CDE仪表板数据源及以下是KTR文件中的某些部分将参数传递给pentaho水壶在kettleTransFromFile中pentaho CDE

<hostname>localhost</hostname> 
<port>27017</port> 
<use_all_replica_members>N</use_all_replica_members> 
<db_name>${db_name}</db_name> 
<fields_name/> 
<collection>test</collection> 
<json_field_name>json</json_field_name> 
<json_query/> 
<auth_user/> 
<auth_password>Encrypted </auth_password> 
<auth_kerberos>N</auth_kerberos> 
<connect_timeout/> 
<socket_timeout/> 
<read_preference>primary</read_preference> 
<output_json>Y</output_json> 
<query_is_pipeline>N</query_is_pipeline> 
<execute_for_each_row>N</execute_for_each_row>` 

和$ {} DB_NAME是我的参数,我想通过这个网址参数,但是当我通过了db_name作为url并读取url参数我得到了url参数,但是我的ktr文件不能理解参数,因此它是在名为$ {db_name}的mongo中创建的数据库,所以我将参数传递给了pentaho CDE中的ktr文件?

回答

2

经过Pentaho数据集成4食谱后,我找到了我的问题的解决方案。我使用以下方法解决了我的问题。

1> First create transformation using PDI and that transformation file add mongodb input. 
2> Click on edit->settings and select parameters and add parameter name as db_name. 
3> In mongodb input set database name as ${db_name} and set collection name save that transformation file. 
4> Now login to pentaho bi server and create new CDE dashboard. 
5> go to datasource and select kettle query and add kettle transformation file and add above created ktr file, in variable set arg as db_name and value blank. 
6> In same datasource add parameters set name as db_name and value your data base name which you want to pass to ktr file in my case db name as demo. 
7> Set above ktr to component panel and it work fine 

更多参考click here