Date format on input control - jasper-reports

I'm using iReport 4.6.0 and JasperReports Server 4.5.0. I've created a report where I want to pass a date value to a MySQL database. I've created a parameter and used java.util.Date class. On the input control, I set it to a single value type, and the date data type. When running the report in iReport (using Preview), I'm prompted to select a date, and it generates the report using the specified date. After deploying the report to the JasperReports Server, when I'm prompted to enter a date, I get an empty report. I noticed the date format is different on the input control on the server (YYYY-MM-DD) than the one when previewing the report in iReport (MM/DD/YYYY). Is there any way to fix this?

I agree with mdahlman. The formatting of the input control shouldn't be a problem. It should be passing a valid date value to the report.
Make sure that the name of the input control (not the label) exactly matches the name of your parameter. And it is case sensitive. If they are not identical, this could be your problem.

Related

Is there a better way to format this date field in Crystal Reports? Im having trouble with a scheduling program and getting the correct data

I have a program that runs reports on a schedule. For some reason the data it pulls is not the same as what Crystal Reports pulls. I was told it has to do with the way that the PO Enter Date field is formatted. It pulls fine from Crystal Reports but the scheduler shows different data. Im not sure where to go from here.
'''
(IF(LENGTH(TOTEXT({POP.PODADD}))=9)
THEN (DateSerial ((TONUMBER("20"+Mid
(Totext({POP.PODADD}),4,2))),
(TONUMBER(LEFT(TOTEXT({POP.PODADD}),1))),
(TONUMBER(MID(TOTEXT({POP.PODADD}),2,2)))))
ELSE (DateSerial ((TONUMBER("20"+Mid
(Totext({POP.PODADD}),5,2))),
(TONUMBER(LEFT(TOTEXT({POP.PODADD}),2))),
(TONUMBER(MID(TOTEXT({POP.PODADD}),3,2))))))
'''
The Crystal Runtime doesn't always "follow" custom formatting defined in Crystal Designer.
If you need a specific formatting, convert the date to formatted text using a formula such as:
ToText({POP.PODADD}, 'yyyyMMdd')
The 2nd argument gives you control over the desired formatting.

Crystal Reports date from DB

I have a problem to display a date in crystal reports. The field is from database, and it shows the time, too. I need to display only the date.
I observed that if I click on the Text Format from the date, in the Font tab at Sample it is showed with time. I think that is the problem, but I can't modify, I can't delete the time from the Sample box.
Do you have any idea how to resolve this?
The data-type of the column inside the database seems to be text/varchar instead of datetime.
The best would be to fix the data-type on the table inside the database.
If you don't have the option to change the datatype directly on the database, you can use following formula to convert it to DateTime inside the report.
If IsDate({Table.DateTimeColumn}) Then DateTime({Table.DateTimeColumn})
On the properties of the formula field there will be the option for the different formats then.

Set Default Current date in parameter fields Crystal Report

I have a problem with Crytal Report (CR) 2013, my customer want to default current date in parameter fields in Crytal Report when they open it. I try to do it with many ways but it not work. i'm looking forward to ur help. Tks all.
Current form
The only way I know to set a current date to a report parameter is by adding your report as a subreport and passing a formula returning current date as a source for the parameter. You may add also a parameter for date in the main report and inside the formula check if the provided value is for example 1/1/1900 then use current date. This will work if you do not have subreports in your report ( Crystal does not support nested subreports) and the user should be aware that date 1/1/1900 should be selected for current date.
Generally speaking default values should be handled by the software , which is running the report. Ask your customer to try application like this one: http://www.r-tag.com/Pages/CommunityEdition.aspx.
I am posting the link because this software is free. My guess is that there are other applications , which are able to set default values for report parameters. You can do your research. Here is a sample video setting a default value for date: http://www.r-tag.com/Pages/Preview_ParameterTemplates.aspx
The video is for different report type, but Crystal reports will be handled in the same way.
I am a colleage of Hai Pham. I give you more information about this issue.
1. datasource: stored procedure
2. set current date is default value in import parameters popup
popup image
3. users can select another value
Thanks,
Dai Nguyen Quang.

Warnings displayed in cells while exporting jasper report in excel format for different data types used in cross tab measure

I am using iReport 4.5.1. Using cross-tab with measures of different data-types namely date and double data-type. Problem is while exporting report in excel, execl gives warning as number stored as text. I cannot handle this in SQL query. I have tried using property in jasper report. But this property has no effect on excel report. I have seen other posts on stackoverflow.com, none of them matches with this requirement.
To display date data-type i have used in measure expression as,
$V{COL1}.equals("FSI") ? new SimpleDateFormat("dd.MM.yyyy").format(java.util.Date($V{COL2Measure}.toString())) : new Double(Double.parseDouble($V{COL2Measure}))
It displays date properly in execl without any warnings. But after type-casting to double still it shows warnings in excel report for numbers. Also Expression class is "java.lang.String". I cannot change it to number or double beacuse date type does not works.I changed expression class to "java.lang.Object", then it gives error in while type casting to Double that be applied to Object.
Any help on this would be greatly appreciated.

Crystal Reports Localization

We're developing an existing application with C# 2.0 and Crystal Reports for Visual Studio 2005. The problem is we want to localize the report dynamically. How to achieve it in Crystal Reports 2005?
So if the current culture is "id-ID", I want my report to display "Rp" instead of "$" , and the date format in in Indonesian format.
Assuming you're building these reports in the Report Designer, right-click on each field in question and select Format Field... . Select the date or number tab as appropriate, then click the Customise... button. Each of the properties you would need to change - thousands separator, decimals separator, currency symbol, DMY order, etc. - can be specified by clicking the formula button for that property, and entering an appropriate formula.
Obviously, you will need to have some way for Crystal to determine that the current culture is eg. "id-ID" - I suggest that this should be by passing the culture value to the report as a parameter. (An alternative would be to include a culture column in the report's datasets, but this would leave the culture undefined for datasets with 0 records.)
I think it should be possible to automate all of this through the API.