How to add a select all option to select component in CDE

谁都会走 提交于 2019-12-02 05:37:49

Use SQL expression CASE:

SELECT * FROM table WHERE cities LIKE (case when ${city} = 'ALL' then '%' ELSE ${city} end)

Two approaches:

  1. On your single select query add (possibly hardcoding) a "All" option and have some JS logic learn how to handle it;

  2. Use multi select components. However, bear in mind that the parameter values on a multi select component are stored as an array in javascript, whereas the parameter value will be passed as a comma separated list to the query. So, if you want to use a multi select parameter in a SQL query you will most likely use it inside a IN condition.

Finally, check your pentaho.log file. The errors and exceptions will be logged there.

If you dont want use like.

SELECT * from table_name where column_name = case when ${param} = 'ALL' then column_name else ${param} end
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!