Issue 122603 - Date field displays incorrect value as number text in Base report
Summary: Date field displays incorrect value as number text in Base report
Alias: None
Product: Base
Classification: Application
Component: code (show other issues)
Version: 4.0.0-dev
Hardware: All All
: P2 Critical (vote)
Target Milestone: 4.0.0
Assignee: hanya
QA Contact:
: 122602 (view as issue list)
Depends on:
Reported: 2013-06-27 07:57 UTC by fanyuzhen
Modified: 2013-12-18 09:34 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---
jsc: 4.0.0_release_blocker+

Proposed patch to fix the problem. (1.05 KB, patch)
2013-06-27 17:42 UTC, hanya
no flags Details | Diff
Test case containing a table with number formatted columns (4.82 KB, application/vnd.oasis.opendocument.database)
2013-06-27 17:59 UTC, hanya
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description fanyuzhen 2013-06-27 07:57:21 UTC
1. Create a table with date field
2. Create a report based on this table and check the value of the date field

Actual result: the date value displays as number char, like "40716"
Expected result: the date value displays as date, like "11/06/22"
Comment 1 oooforum (fr) 2013-06-27 08:35:49 UTC
Maybe linked with
Comment 2 fanyuzhen 2013-06-27 08:36:11 UTC
*** Issue 122602 has been marked as a duplicate of this issue. ***
Comment 3 hanya 2013-06-27 15:40:49 UTC
It seems not only for Date but also for other kind of data types.
As a workaround,
- open the report document to edit.
- Select a column and choose Table - Number Format in the main menu and apply format.
- Save the document.
Comment 4 hanya 2013-06-27 17:31:57 UTC
I got the following error during the new report creation using the report wizard.
Each cells of the created table on the report document takes the same 
number format with the bound column in NumberFormatter.setNumberFormat method. 
Before to set NumberFormat property to the cell, FormatsSupplier property 
is tried to set. But current cell in the table on the text document does not have 
FormatsSupplier property. The following error raised and NumberFormat is not set. FormatsSupplier
	at Method)
	at sun.proxy.$Proxy6.setPropertyValue(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at Method)
	at sun.proxy.$Proxy110.execute(Unknown Source)
Comment 5 hanya 2013-06-27 17:42:55 UTC
Created attachment 80925 [details]
Proposed patch to fix the problem.

When setNumberFormat method is called from DBColumn::initializeNumberFormat method, 
the number formatter is the document's one. 
And the passed arguments are from the database column. 
Before the format key is set to the table cell, the format key from the 
column is used to generate new key on the number format supplier. 
Therefore to set FormatsSupplier property of the cell is not required 
(I mean, document's one is used).
The same setNumberFormat method is called from other wizard, so the line 
should not be removed, check the property existence before to set it.
Comment 6 hanya 2013-06-27 17:59:04 UTC
Created attachment 80926 [details]
Test case containing a table with number formatted columns

To verify: 
- Open the attached NumberFormatTest.odb file.
- Click Reports in Database and then click Use Wizard to Create Report...
- Push >> button to add all fields to the report.
- Push Finish button.
The result should be: 
0 01/01/2000 100.0200
1 02/02/2001 200.0001
2 02/02/2002 300.1000
for the following number formats: DATE: YYYY/MM/DD, VALUE: 0.0000
Comment 7 Kay 2013-06-30 22:54:54 UTC
Confirmed as well. Thanks for the patch. We'll check it out.
Comment 8 2013-07-09 08:22:55 UTC
Confirming the original problem too and confirming that Hanya's patch works great (as always :-) ). Thanks for the patch!

Suggesting to include it in the imminent release: The patch fixes the problem and cannot have any impact on other areas.
Comment 9 jsc 2013-07-09 08:23:40 UTC
grant showstopper flag, patch available
Comment 10 SVN Robot 2013-07-09 08:49:00 UTC
"hdu" committed SVN revision 1501137 into trunk:
#i122603# fix database wizard's use of the Numberformatter
Comment 11 2013-07-09 08:52:42 UTC
Applied Hanya's patch and updating the status to FIXED.
Comment 12 Rainer Bielefeld 2013-07-21 14:19:52 UTC
Changed "Assigned to" to patch submitter to ease reliable queries.