Jump to content
Changes to the Jaspersoft community edition download ×

$V!{Variable} just like $P!{Parameter}


Recommended Posts

Why is it impossible to use a variable literally in a query? A parameter can be used this way with $P!{} syntax, why not make something like $V!{}? Thus I could assemble some parts of the query within the report itself, instead of messing with it outside the report. After all, what's the difference between a parameter and a variable in this respect? If I have a variable that only depends on paramters, then I should be able to use it in any place where a parameter fits. I was surprised to find out that it's not the case with JasperReports.

I'm using JasperReports 1.2.2 by the way. Is there any chance of ever seeing such a feature?

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic



Variables cannot be used inside the query because it does not make any sense. They are probably not even initialized by the time the query is evaluated and executed at the beginning of the report filling process.


What you need is to use the <defaultValueExpression> of a dummy report parameter that combines other parameters as you wish. Make sure you do not supply a value for this parameter so that the default value expression kicks off.


I hope this helps.


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