jkeri Posted May 19, 2017 Share Posted May 19, 2017 I have a Jasper report with 3 paramaters. I have started to publish it and was able to create a SQL for one of the parameters but I dont know how to handle the other parameters that are date ranges (DATEFROM and DATETO).what needs to be done for the date parameters? Link to comment Share on other sites More sharing options...
Alex42 Posted May 19, 2017 Share Posted May 19, 2017 You can create date type input controls that will show a calendar and let user select from the calendar the date from and date to.The Report parameter behind the input control needs to be of compatibale type. ex: java.sql.Datethe SQL would look something likeSelect <fields>from <table>where ( $X{GREATER, date_field, DATEFROM_param } and $X{LESS, date_field, DATETO_param}) Link to comment Share on other sites More sharing options...
jkeri Posted May 19, 2017 Author Share Posted May 19, 2017 I disagree with your answer. it is better to use SQL BETWEEN as in this case: and pay.payment_date between $P{DATEFROM} and $P{DATETO} But that is not my original question. I was asking during the publishing step, do I need to do anything to the date parameter to pop up or is that done at the time input controls are created? Link to comment Share on other sites More sharing options...
Alex42 Posted May 19, 2017 Share Posted May 19, 2017 what do you mean pop up?an input control has asociated a parameter that you need to use in your query in order to be able to filter. You can mark said parameter "for prompting" when creating it.When you publish the report for the first time you will be able to select which for prompting parameters you actually want to publish(this will publish them as a local resource to the report). At future publish operations, unless you change the parameter/input control definition, the input control publishing window will be skipped or appear with Ignore preselectedOnce published, by selcting the report and then edit you can access all input controls and configure if you want then in a popup/in a separate page, etc. You can also add/create input controls here in the server, just make sure the parameter behind it matches the one used in the report query. Here input controls can be added also as resources from repository not as local resources. Its recommended to do it like this if you have the same input control over many reportsHope this helps, if this is not what you were looking for, then i really don't understand what you wand. :) Link to comment Share on other sites More sharing options...
hozawa Posted May 20, 2017 Share Posted May 20, 2017 Defining parameters and sql statement are included in your jrxml file. This is just a xml file so opening this file with a text editor won't popup a parameter input.Jaspersoft Studio and JasperReports Server are software that process this jrxml file. As such, they will show parameter input field when a report is executed. In Jaspersoft Studio, this is when you preview the report. In JasperReports Server, this is when you open a report. Nevertheless, in JasperReports Server, you'll need to setup to display these parameter inputs.http://community.jaspersoft.com/documentation/tibco-jasperreports-server-user-guide/v630/running-report-input-controls-or-filters If you are developing an application that uses JasperReports library, you'll have to create your own input entry logic in your program. Parameters are often passed as Map<String, Object> 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