Jump to content
Changes to the Jaspersoft community edition download ×

defaultValueExpression parameter evaluation..

2005 IR Help

Recommended Posts

By: Michael Bauer - mbabauer

defaultValueExpression parameter evaluation..

2004-08-18 12:45

I am trying to use parameters to build a dynamic SQL statement from within my report, and am having some problems getting the parameters to evaluate properly.


Currenlty, using this in the XML (escaping used for '+' and other illegal XML chars):

<defaultValueExpression >

"SELECT * FROM INV4.DIST_STATE WHERE SOURCE_APPLICATION=" + $P{Source} + ($P{From}!=null ? "AND START_TIME > " + $P{From} : "")


With $P{Source} evaluating to "Software", I get the following SQL back:


The problem here is that Software is a text value and needs to be quoted. So I tries something like:

<defaultValueExpression >

"SELECT * FROM INV4.DIST_STATE WHERE SOURCE_APPLICATION='" + $P{Source} + "'" + ($P{From}!=null ? "AND START_TIME > " + $P{From} : "")


But this causes my SQL to evaluate to:

SELECT * FROM INV4.DIST_STATE WHERE SOURCE_APPLICATION= + ((java.lang.String)parameter_Source.getValue()) +


Does anyone know what might be going on here? Looks like the ' marks are also being evaluated wrong. Thoughts?

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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