Issue 126404 - Lost precision when copying table data
Summary: Lost precision when copying table data
Alias: None
Product: Base
Classification: Application
Component: code (show other issues)
Version: 4.1.1
Hardware: All Windows 7
: P5 (lowest) Normal (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
Depends on:
Reported: 2015-07-16 10:35 UTC by Lars Jødal
Modified: 2017-05-20 09:36 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---

Sample database with high-precision data (3.30 KB, application/zip)
2015-07-16 10:35 UTC, Lars Jødal
no flags Details
Sample database, second go (3.33 KB, application/zip)
2015-07-16 12:56 UTC, Lars Jødal
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Lars Jødal 2015-07-16 10:35:52 UTC
Created attachment 84825 [details]
Sample database with high-precision data

When copying data from a table (or query) in Base, the data is copied "as shown" which leads to loss of precision. I would expect that copying a table from Base to Calc would preserve full precision, but this is not the case.

Example: The attached sample database contains a table with the following data:

MyTimestamp            MyDouble
01-01-2015 00:00:01    1.2345
01-01-2015 00:00:15    3.1415

However, when the table is opened then the times is only shown the the level of minutes, and the numbers are rounded to two decimal places:

01-01-15 00:00         1.23
01-01-15 00:00         3.14

Showing it like this is not an error, but when I copy the data then data are only copied to this precision. This is the case whether I copy the whole table, or open the table and choose all data. Thus, precision is SILENTLY lost in the copying process. I learned this only after loosing data in a copy.

(Full precision is kept if database is registered and a connection made to the data from Calc.)

Lars J
Comment 1 mroe 2015-07-16 12:02:50 UTC
I cannot confirm your observation. Maybe you have simply to change the number format in calc? If this is not the case please provide a step-by-step description how to reproduce the described behaviour.
Comment 2 Lars Jødal 2015-07-16 12:56:57 UTC
Created attachment 84826 [details]
Sample database, second go

You are right, surprisingly the problem cannot be seen with the sample base I posted. Before posting, I tried changing the format for showing the data and apparently succeeded in circumventing the problem (at least after saving).

Still, the basic problem is there. I have attached a new sample database with the same data. Only this time I have not changed the default formatting:

TIMESTAMP: Format 00:00:00 00:00
Double: Format "Standard"

To see the problem I do this:
1. Open the database (sample2.odb)
2. Choose table view, rightclick on "Table1", and choose "Copy"
3. Open a new Calc spreadsheet
4. Paste the contents of the clipboard

Both time values are pasted as 01-01-15 00:00:00 (seconds not shown by default), and the number values are pasted with only two digits.

AFTER having confirmed this behaviour, try changing the column format to verify that there was actually more precision. (It would seem that if you THEN copy, the precision will follow what is now shown.)

By the way: Going to the table and editing the data, I can neither see the full precision by default, which could lead to precision loss in editing. A new issue, or a second angle of the same?

Lars J
Comment 3 mroe 2015-07-18 11:18:29 UTC
Hello Lars!

Now I can follow you, but in my opinion it is not a bug - it works as designed.
I'm not a AOO developer but I can imagine that it will result in big trouble if a huge database table is copied into the clipboard.

Compare Paste Special… in Base and in Calc if you copied a database table into the clipboard.

Formatted text (RTF)
HTML (HyperText Markup Language)
Data source table

Formatted text (RTF)
HTML (HyperText Markup Language)

HTML and Text have no option to format a full precision value. And a HTML table with full precision nobody want to have.

Data source table is IMHO only a link to the source not the data itself.

But you can simply copy the values without using the clipboard.

Open the base table and a calc spreadsheet. Select the desired rows in the table and drag them with the mouse to the calc document.
Comment 4 Lars Jødal 2015-07-20 06:01:51 UTC
Thanks, copying by selection and dragging gives the full precision.
I still thinks the behaviour is somewhat misleading, since it does not tell that precision is lost. 

Replacing the standard "copy" (as shown) with two choices "copy as shown" and "copy with full precision" would make things more clear. But I take your point that it is not a bug, so instead of continuing here I will open a new Request for Enhancement with that suggestion. Thanks for the comments.

Best regards,
Lars J