kiran_3 Posted January 31, 2015 Share Posted January 31, 2015 I am new to jasper reports , I want to build a report which takes few fields among them few are required and few not required fields. I ran a sample report in jasper studio which has single parameter . how can I mention such non required parameters in the query . Required parameter can be mentioned as below.select * from member where first_name=$P{param_name}; is there anyway to put non-required field in that query, say when i run the report it asks me to enter that parameter rite , if i didn't give param value it doesn't execute the report. in my case if i give parameter take it show based on it else show me all records. can i do it using any if else condition? Link to comment Share on other sites More sharing options...
msweeney6 Posted February 3, 2015 Share Posted February 3, 2015 Hi,I use the $X{} function for not required fields.Your code would look like this:select * from member where $X{IN, first_name, param_name}Hope this helps! Link to comment Share on other sites More sharing options...
kiran_3 Posted February 3, 2015 Author Share Posted February 3, 2015 no it didn't work and its still prompting me the param to fill, it seems not a straight forward thing, my code is here http://pastebin.com/7QzHV5zp u can check and suggest me a work around. i am using jasper studio. Link to comment Share on other sites More sharing options...
msweeney6 Posted February 3, 2015 Share Posted February 3, 2015 OK. How is your parameter set up? I set mine up when using this function as a 'Multiple Select query' this function lets you select more than one option or none at all so I set it up to do that, this does require you to provide the SQL for the select list options. The parameter will still prompt if you have it set to prompt, you just won't have to select anything from the list. I'm sorry, I don't have much success changing the XML and it working so I hope my above suggestions help. 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