Jump to content
We've recently updated our Privacy Statement, available here ×

String parameter with quotes


ngutierrez

Recommended Posts

I have a report made in ireport 3.0.0 wich receives a string parameter from another application; this is the query report:

SELECT
     accounts.`name` AS accounts_name,
     accounts.`account_type` AS accounts_account_type,
     accounts.`industry` AS accounts_industry,
     accounts.`billing_address_street` AS accounts_billing_address_street,
     accounts.`billing_address_city` AS accounts_billing_address_city,
     accounts.`billing_address_country` AS accounts_billing_address_country
FROM
     `accounts` accounts
WHERE
 accounts.name >= $P{CUENTA_DESDE} and
 accounts.name <= $P{CUENTA_HASTA}

In CUENTA_DESDE I have some strings like: Agencia "La buena suerte" or Kiosco "El grande", and the parameter in ireport truncates as Agencia or Kiosco. Any idea to solucionate this? How to put quotes?  Sorry for my english

 

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Maybe you could try converting the " to ' ?

In mySQL you could use the REPLACE function to do this:

http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace

Also you could try to do it in Java.

Create a second parameter in the report who's default value is:

$P{originalParameter}.replaceAll(""", "'")

Then use this second parameter in your query.

Hope this helps.

 

Link to comment
Share on other sites

I tried doing that and when I put the second parameter in the WHERE clause like: accounts.name >= $P{CUENTA_DESDE2} and accounts.name <= $P{CUENTA_HASTA2} I get the following error: Error: sourced file: inline evaluation of: ` ` param_CUENTA_DESDE.replaceAll(""","'");"

Any idea of what this error is?  

 

Link to comment
Share on other sites

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...