简体   繁体   中英

generate SQL query in Pentaho report designer with parameters

I created two parameters named id and task_name in Pentaho report designer. Display type of both of them are drop down. When I am trying to change the query based on the parameters I didn't get any data in the drop-down. But the data of the drop-down display when I do not edit the query with parameters My query is

SELECT * 
FROM tbl_project_tasks 
WHERE id = ${id}

can anyone help?

In the parameter you'll find a field named Query . This query should not be the main query mentioned above. You should create a new query in which you only select the id from your data base. Name it idparameter for example. It goes like this:

SELECT id 
FROM tbl_project_tasks

Now in the parameter select idparameter in Query , id in Value and id in Display Name . Make sure that the name of the parameter in Name is the same as the one in the ${} in the main query.

Hope that was the answer for your question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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