2005 IR Help Posted August 26, 2006 Share Posted August 26, 2006 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} : "") </defaultValueExpression> With $P{Source} evaluating to "Software", I get the following SQL back: SELECT * FRFROM INV4.DIST_STATE WHERE SOURCE_APPLICATION=Software 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} : "") </defaultValueExpression> 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now