Jump to content
Changes to the Jaspersoft community edition download ×

How do handle Parameter value with an apostrophe


Recommended Posts

I have a long complex query that uses several parameters to filter the report. The user can choose multiple values from a parameter list. The problem is that some of the parameter values have an apostrophe in them and cause the report to fail.

An over simplified example would be:

     Select bla, bla, bla where  client in ('PwC', McDonald's') 

I'm using something like  $X{IN, client ,  Client_Params }

It works fine as long as the user has not chosen a parameter value that contains an apostrophe.

How do I get around this problem?


Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

  • 3 weeks later...

Hi bdonnelly,

I tried with the same scenario, but couldn't replicate the same on JRS 8.0.4 server connected to Postgres database.

Could you please share your jrxml. Please mention your database as well?


Please see the sample JRXML SQL  which I used 


<property name="ireport.jasperserver.reportUnit" value="/organizations/organization_1/reports/PDF_test"/>
    <parameter name="Client_Params" class="java.util.List"/>
    <queryString language="SQL">
        <![CDATA[sELECT physician_name,
FROM physician where
$X{IN, physician_name, Client_Params}]]>

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...