Jump to content

Input Control: Specify a valid value for type Date


xefil

Recommended Posts

Code:
Hello to all!

I've a little issue after upgrading JasperServer from version 4.5 to verion 4.7.
The first problem was the update. case sensitive tables on mysql wasn't so easy to update, btw I've done it succesfully.

Then, via iReport I can browse the Jasperserver repository and execute reports well, without any issue. When I try to execute the same report on the JasperServer it fails always to validate data fields.

My report asks for a list of options in drop down window (made by a query) and this works. Then it asks for start and stop date. Using the calendar I can specify a date but then on SUBMIT I obtain always the following error:

"Specify a valid value for Date."

The Input contro is made using a datatype created on the server and via iReport I've choosen to use it (via repository). The datatype has nothing special set. How can I troubleshoot/debug this problem?

Thank's a lot!

Simon
Link to comment
Share on other sites

  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

Hi

I have date related problem in hyperlink report. The date not passed to the child report and gives error "Specify valid value for date". So I solved that problem by passing date in following formate with datatype STRING:

(date.getYear( )+1900)+"-"+(date.getMonth( )+1)+"-"+date.getDate( )

 

 

 

 

Link to comment
Share on other sites

Hello!

 

Thank you for your answer. I cannot apply totally your workaround. Let me explain what I've done. I'm working on the JasperServer editing an existing report using iReport connected directly to the JasperServer's repository.

My goal is to let persons execute the reports from within the jasperserver java web GUI, *not* using iReport.

My report asks the user on the Jasperserver's Tomcat page by a popup about start and stop dates. These are not be accepted anymore, with the error "Specify a valid value for Date.".

As descrived by you I've changed the Input Control. I've created on the server a new input control as follow:

 

Type: TEXT

Name: date_text

Description: empty

Format: (date.getYear( )+1900)+"-"+(date.getMonth( )+1)+"-"+date.getDate( )

 

First of all, saving the above Input Control the "format" field is cutted to "(date.getYear( )+1900)+"... hmmm...

Then, changing the input control to the report I obtain two results:

1. The popup doesn't ask for dates using a nice calendar to choose dats, because now it's a text field. This is not so good.

2. Even if I've insert the format of the datatype ((date.getYear( )+1900)+...) the field is still empty

 

I know the point one is a normal result because I've changed the input type. But why I cannot obtain the suggested precompiled dates in the fields?

 

BTW this workaround let me execute the report. It's a step forward :)

 

Thank's for answers and support.

Link to comment
Share on other sites

Hi

The formate of date change & datatype should not be done at Jasperserver. it should be done at the Parameter mapping in hyperlink at iReport and specify date with "yyyy-mm-dd" format. Do not make Change in jaspersever input controls. Then you can select start and stop date from popup calender and it works fine.

I have a question "Can I change date format in Jasper input control other than "yyyy-mm-dd"?"

Link to comment
Share on other sites

I ran into a similar issue trying to supply a standard ISO date to Teradata using the java.util.date parameter. I needed to supply starting and ending date in format as '2012-09-01' but it kept passing the longer format and resulting in errors. The solution was to format the date in the where clause.

 

In my case:

 

SELECT

*

FROM

VIEW.TAB

WHERE Tab.Col = '$P{Start_Date}' (Date, Format 'yyyy-mm-dd')

Link to comment
Share on other sites

 

Hello!

Well, formatting the date in the SQL statement should solve my problem for the output on the Jasper Report. BTW I've just noticed I can select into iReport the output field and into properties select the pattern to apply. This works and this is referred to the output of the date printed on the report.

This solves the problem of printing the date on the report in a different format. I still have a problem for formatting the date in the input control.

As suggested by ajinkya_c, I've defined the input control locally and not on the server:

Properties of the selected input control -> "Input Control Details"

--- Type "Single Value"
--- "Locate(Datatype) -> "Locally Defined" -> "Edit Local Resource (Datatype)"

On General Tab nothing special to notice. On "Data Type Details" TAB:

--- Type: Date
--- Pattern: ???????????

I then run the report and I have my nice calendar to choose dates. BTW selecting the date, the field is filled in this format: "mm/dd/yyyy" and I need to format it into "yyyy-mm-dd" to validate the field. I've tried it manually changing the field and it works.

How can I modify the return format of the calendar? I've tried editing the pattern above setting it to "yyyy-mm-dd" but it's ignored. Do I need a special syntax to setup the pattern?

 

Thank's for the support!

Simon

 

NOTE: I would avoid using MySQL function DATE_FORMAT in WHERE clause because, AFAIK it converts all dates in string and then makes the comparsion. This would not an optimized query. I've a very large DB.



Post Edited by xefil at 09/10/2012 08:27
Link to comment
Share on other sites

  • 4 weeks later...

The trick is with how jQuery Datepicker is filling in your input field value.

 

Here's what worked for me:

1. Open jasperserver/scripts/jquery/js/jquery-ui-1.8.20.custom.min.js

2. Find dateFormat:"mm/dd/yy"

3. Change to dateFormat:"yy-mm-dd"

 

This allows my users to just use the calendar in the input control to select their desired dates.

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