Q:

Need help in creating parameterized query using Pentaho CDE

I am developing one dashboard using Pentaho CDE. I have created one query to fetch organization names from database.
Following query works perfectly for me :
select top 5 
employer_name,count(emp_id) as emp_count
from employment_details 
where employer_name=${employer}
group by employer_name 
order by emp_count desc 

I want to change the where clause so that instead of using =, I want to use like clause. So I modified query as follows :
select top 5 
employer_name,count(emp_id) as emp_count
from employment_details 
where employer_name like ${employer}
group by employer_name 
order by emp_count desc

but its not giving me proper results. For example, if value of ${employer} is IBM then query returns rows having employer_name exactly as IBM. 
I tried changing where clause to     where employer_name like '%${employer}%' but its not working.

EDIT 1

As per suggestions by pdpi, I tried to use double quotes instead of single quote around ${employer} but now I am getting Parent exception: Invalid parameter index 1. exception. Following is some part of stacktrace :
pt.webdetails.cda.dataaccess.QueryException: Found an unhandled exception:
        at pt.webdetails.cda.dataaccess.SimpleDataAccess.queryDataSource(SimpleDataAccess.java:299)
        at pt.webdetails.cda.dataaccess.AbstractDataAccess.doQuery(AbstractDataAccess.java:312)
        at pt.webdetails.cda.CdaEngine.doQuery(CdaEngine.java:51)
        at pt.webdetails.cda.CdaContentGenerator.doQuery(CdaContentGenerator.java:299)
        at pt.webdetails.cda.CdaContentGenerator.createContent(CdaContentGenerator.java:139)
        at org.pentaho.platform.web.servlet.GenericServlet.doGet(GenericServlet.java:261)
        at org.pentaho.platform.web.servlet.GenericServlet.doPost(GenericServlet.java:80)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j
    ava:290)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
            at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)
            at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProto
    col.java:579)
            at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
            at java.lang.Thread.run(Thread.java:619)
    Caused by: pt.webdetails.cda.dataaccess.QueryException: ReportDataFactoryException : Failed at query
    : select top 5
    emp.employer_name,count(emp.rinx_id) as candidate_count
    from tbl_cand_employment_details emp
    where emp.employer_name like "%${employer}%"
    group by emp.employer_name
    order by candidate_count desc; Parent exception: Invalid parameter index 1.
            at pt.webdetails.cda.dataaccess.PREDataAccess.performRawQuery(PREDataAccess.java:116)
            at pt.webdetails.cda.dataaccess.SimpleDataAccess.queryDataSource(SimpleDataAccess.java:288)
            ... 68 more

Please help me in forming this query.

EDIT 2

My problem is solved now. Thanks to this question on Pentaho forum.
I modified my where clause as follows and now its working : 
where employer_name like '%' + ${employer} + '%'

A:

As PDPI Says, you should use "%${employer}%" i.e. double quotes not single quotes. Then it should work.

