bporter Posted October 6, 2006 Share Posted October 6, 2006 Hi all, Assume that I have an SQL statement such as: Select type from user where type = $P{typeParam} As long as typeParam has a value, it works fine. But what if the user wants to see all the records in user table... In this case typeParam value will be null (and there is no default value assigned to typeParam). There are some "workarounds" like passing the where clause (or even passing the whole SQL) from the application side, but it lowers the usability of iReport... Any idea? Link to comment Share on other sites More sharing options...
ed4becky Posted October 6, 2006 Share Posted October 6, 2006 I have done something simliar before: Select type from user where (type = $P{typeParam} OR $P{typeParam} IS NULL) Link to comment Share on other sites More sharing options...
bporter Posted October 6, 2006 Author Share Posted October 6, 2006 Thanks ed4becky, good solution. So iReport sends the final SQL statement to the DB Engine as "... where ... null is null" which is always true. Very much appreciated... Link to comment Share on other sites More sharing options...
acer Posted October 6, 2006 Share Posted October 6, 2006 Hi bporter, How did you manage to pass a parameter with a null value? I encounter"Please enter a default value for paramter <paramname>" I am trying to search for an ireport equivalent behaviour for the JDBC's preparedStatement.setNull() 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