Jump to content
We've recently updated our Privacy Statement, available here ×

Input Controls and Parameters


medium_grade

Recommended Posts

Hello, I am brand new to Jasper Reports and I need a little help in setting up input controls for report paramters.

I have setup the following parameters within the report: from_date, to_date. The query for the report is as follows:

SELECT * FROM v_OE_Invoice_Headers
WHERE INVOICEDATE between '$P{from_date}' and '$P{to_date}'
ORDER BY INVOICEDATE;

For the report, I have setup two input controls. One in which the Parameter Name is from_date and the other for which the Parameter Name is to_date. When I run the report, the server prompts me for these input fields, but then throws the following error:

com.jaspersoft.jasperserver.api.JSExceptionWrapper: Error preparing statement for executing the report query : SELECT * FROM v_OE_Invoice_Headers WHERE INVOICEDATE between '?' and '?' ORDER BY INVOICEDATE;

com.jaspersoft.jasperserver.api.JSExceptionWrapper: net.sf.jasperreports.engine.JRException: Error preparing statement for executing the report query :

SELECT * FROM v_OE_Invoice_Headers
WHERE INVOICEDATE between '?' and '?'
ORDER BY INVOICEDATE;

Is there a step I am missing in all of this?

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Maybe try removing the single quotes around the parameters in the WHERE? I'm new to this too, but the stuff I've done I've just used $P{parameter_name} and not quoted it. I haven't used dates yet for parameters, so not sure if that will work, and maybe you quoted it since you can pass dates as quoted text in SQL, but I don't think it would matter here as should be handled by the execution engine. Are the datatypes of the parameters and the input controls the same?
Link to comment
Share on other sites

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