Bug 131943 - Libreoffice Base not showing enough decimal precision for query
Summary: Libreoffice Base not showing enough decimal precision for query
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86-64 (AMD64) Linux (All)
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-06 22:34 UTC by fox2
Modified: 2020-04-07 18:38 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description fox2 2020-04-06 22:34:43 UTC
Description:
I have two fields "county_population" and "state_population" each formatted as double[DOUBLE]. The third field is a calculated field "county_population" / "state_population". When I run query, the results show only two decimal places; I would like it to show six decimal places. I've tried using CAST as DECIMAL and I've tried multiplying "county_population" *1.000000 to no avail.

Steps to Reproduce:
1. create two fields "state_population" "county_population" both formatted as double[DOUBLE]
2. create a calculated field density "county_population"/"state_population"
3. run query

Actual Results:
state_population	county_population	density
4908621	55869	0.01
4908621	223234	0.05
4908621	44428	0.01
7378494	38837	0.01
2910357	8525	0


Expected Results:
state_population	county_population	density
4908621	55869	0.011382
4908621	223234	0.045478
4908621	44428	0.009051
7378494	38837	0.005264
2910357	8525	0.002929



Reproducible: Always


User Profile Reset: Yes


OpenGL enabled: Yes

Additional Info:
none
Comment 1 Robert Großkopf 2020-04-07 05:49:48 UTC
Did you change the format of the column? It will only show 2 decimal places by default, but when I change it to four decimal places it will show the expected result here.
Comment 2 Robert Großkopf 2020-04-07 06:02:50 UTC
Note: Formatting of a query isn't saved anywhere. So you will loose the formatting after closing and reopening the query.

You will get the formatting saved in views, in forms or in reports.
Comment 3 fox2 2020-04-07 16:40:13 UTC
Formatting the query column works, but I shouldn't have to format the columns each time I run a query.  Also, when I save the query, it reverts back to two decimals and the report is based off the saved query.  I really think this needs to be fixed.
Comment 4 Robert Großkopf 2020-04-07 16:53:49 UTC
(In reply to fox2 from comment #3)
> Formatting the query column works, but I shouldn't have to format the
> columns each time I run a query.  Also, when I save the query, it reverts
> back to two decimals and the report is based off the saved query.  I really
> think this needs to be fixed.

You need this query for a report? The report will save the formatting of a field. There is nothing lost. Only the query doesn't show this by default.

One hint together with reports: I don't use queries for a report, because it works only with simple queries. I prefer to create view for a report.

I will set this one to NEW and ENHANCEMENT, because it has never been possible to save the formatting of a query. Also switched the version to "Inherited From OOo"
Comment 5 fox2 2020-04-07 18:38:52 UTC
(In reply to Robert Großkopf from comment #4)
> (In reply to fox2 from comment #3)
> > Formatting the query column works, but I shouldn't have to format the
> > columns each time I run a query.  Also, when I save the query, it reverts
> > back to two decimals and the report is based off the saved query.  I really
> > think this needs to be fixed.
> 
> You need this query for a report? The report will save the formatting of a
> field. There is nothing lost. Only the query doesn't show this by default.
I don't necessarily need it for a report; nonetheless, I am unable to save the format.  steps: right click on column > column format > decimal places=6 > ok > file > save > close > double click query...back to two decimal places.
I can reformat column again, but am unable to save it, so I can't get the report to show six decimal places.
> 
> One hint together with reports: I don't use queries for a report, because it
> works only with simple queries. I prefer to create view for a report.
I will try working with query/view
> 
> I will set this one to NEW and ENHANCEMENT, because it has never been
> possible to save the formatting of a query. Also switched the version to
> "Inherited From OOo"
Thank you