Jump to content

MySQL Dates and Calendar Input Contol


dogfuel

Recommended Posts

What is the best practice for dealing with the 'feature' that returns dates from the Calendar Java-style (and, if it is intentonal, why does iReport handle it differently than JasperServer)?

 

I assume handling this in SQL as some suggested is really bad for performance.

 

Do I set a default parameter value that converts? Can/do I create a variable that converts the prompt value and se the variable in the report (and are things calculated in a sequence that allows this)?

 

Is there a step by step guide to dealing with this (for dummies. like me)?

 

Thanks

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

nothing is wrong in JasperServer - didn't mean to sound critical.

 

The Calendar control in JasperServer returns a date in a java format that MySQL cannot use without reformatting - iReport's calendar prompt returns a date that does work with MySQL.

 

The question can be rephrased as "what is the cleanest way to use a JS 2.01 Calendar control as a prompt for a report on a MySQL source?"

 

thanks

Link to comment
Share on other sites

The cleanest way would be to only use date values (and never explicitely format/parse dates to String) by create a java.util.Date parameter in the report, using it in the query via a $P{..} placeholder, and defining a date input control for it in JasperServer. The JRXML would contain something like

Code:

<!-- JRXML -->
<parameter name="DateParam" class="java.util.Date" isForPrompting="true"/>
<queryString>SELECT ... WHERE date_column = $P{DateParam}</queryString>

 

If this doesn't work in JasperServer, it's a bug. In this case, please provide enough information so that we'd be able to replicate it.

 

Regards,

Lucian

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