Issue 59676 - The SUM in a Query is Wrong (it's text not a number)
Summary: The SUM in a Query is Wrong (it's text not a number)
Status: CLOSED IRREPRODUCIBLE
Alias: None
Product: Base
Classification: Application
Component: code (show other issues)
Version: OOo 2.0.1
Hardware: PC Linux, all
: P2 Trivial (vote)
Target Milestone: ---
Assignee: marc.neumann
QA Contact: issues@dba
URL:
Keywords:
Depends on:
Blocks: 52908 58101
  Show dependency tree
 
Reported: 2005-12-22 13:31 UTC by Mechtilde
Modified: 2008-01-18 15:11 UTC (History)
2 users (show)

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


Attachments
BeispielDB in MySQL (1.61 KB, text/plain)
2006-01-06 11:51 UTC, Mechtilde
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Mechtilde 2005-12-22 13:31:21 UTC
I have a Query in which I want to add somme currencies by the function SUM. The
result has lost the decimal after the comma (in German).

If I test the same query directly in MySQL it works correctly.

It seems that the addition is correct but not the display of the result.

I seems to be an old mistake also in 1.1.x as I saw in an older book about OOo.
Comment 1 Mechtilde 2006-01-06 10:39:11 UTC
I wrote a workaround for this Issue:

www.mechtilde.de/mysql2ooo/summenproblem.html
Comment 2 Mechtilde 2006-01-06 10:48:30 UTC
I try it as the intern db (HSQL) as MySQL 4.1 via ODBC.3.51.09 (Debain Sarge)
Comment 3 Mechtilde 2006-01-06 10:52:17 UTC
I've done a wrong link:
http://www.mechtilde.de/mysql2ooo20/summenproblem.html
Comment 4 Mechtilde 2006-01-06 11:51:01 UTC
Created attachment 32957 [details]
BeispielDB in MySQL
Comment 5 Mechtilde 2006-01-06 11:54:53 UTC
add to CC
Comment 6 Mechtilde 2006-02-18 16:39:15 UTC
I tested it also with RC1 of 2.0.2

and the sum is wrong

see also http://www.mechtilde.de/mysql2ooo20/summenproblem.html

there is a german description and screenshots which show the right sum with HSQL
and the wrong sum with a MySQL-DB
Comment 7 Mechtilde 2006-02-18 16:40:09 UTC
reassigned
Comment 8 marc.neumann 2006-03-23 10:49:24 UTC
Hi,

I can't reproduce this.

I have used:
locale=de_DE.UTF-8
myodbc.3.51.11
OOo 2.0.2

The query return the right number with decimal places.
The 'Betrag' field is an float field.(may be it's important)

Can you please check this again with the current myodbc driver 3.51.11.

I set this issue now to WORKSFORME.

Bye Marc
Comment 9 Mechtilde 2006-04-08 21:32:04 UTC
Now it works also for me in m162
with odebc 3.51.09

Thanks Marc

so the issue can be closed
Comment 10 marc.neumann 2006-04-10 07:51:44 UTC
So I close this issue now.

Bye Marc
Comment 11 Mechtilde 2006-04-26 13:44:35 UTC
If you use an English locale it works right

There is something wrong with the localisation and the ODBC-Driver and MySQL.
Comment 12 Mechtilde 2006-10-15 20:01:02 UTC
Now I use m186

I reopen this issue.

there are some changes with the problem.

The query shows the right values with the right decimals.

But:

If I choose F4 in Calc and want to transfer the query to the table. I can't
calculate with this values.

A right chlick on the top of the column showsthat it is formatted as "text".

What can I do to get currency values to calculate with.

Comment 13 Mechtilde 2006-10-20 19:30:17 UTC
some thing has changed here:

to get the wright values in calc via F4 you can't use the workaround posted before.
First you have _to mark_ the colums you want to format.

Now you can use the following macro:

sub number2number
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "NumberFormatValue"
args1(0).Value = 10108

dispatcher.executeDispatch(document, ".uno:NumberFormatValue", "", 0, args1())

rem ----------------------------------------------------------------------
dim args2(17) as new com.sun.star.beans.PropertyValue
args2(0).Name = "SearchItem.StyleFamily"
args2(0).Value = 2
args2(1).Name = "SearchItem.CellType"
args2(1).Value = 0
args2(2).Name = "SearchItem.RowDirection"
args2(2).Value = true
args2(3).Name = "SearchItem.AllTables"
args2(3).Value = false
args2(4).Name = "SearchItem.Backward"
args2(4).Value = false
args2(5).Name = "SearchItem.Pattern"
args2(5).Value = false
args2(6).Name = "SearchItem.Content"
args2(6).Value = false
args2(7).Name = "SearchItem.AsianOptions"
args2(7).Value = false
args2(8).Name = "SearchItem.AlgorithmType"
args2(8).Value = 1
args2(9).Name = "SearchItem.SearchFlags"
args2(9).Value = 71680
args2(10).Name = "SearchItem.SearchString"
args2(10).Value = "."
args2(11).Name = "SearchItem.ReplaceString"
args2(11).Value = "&"
args2(12).Name = "SearchItem.Locale"
args2(12).Value = 255
args2(13).Name = "SearchItem.ChangedChars"
args2(13).Value = 2
args2(14).Name = "SearchItem.DeletedChars"
args2(14).Value = 2
args2(15).Name = "SearchItem.InsertedChars"
args2(15).Value = 2
args2(16).Name = "SearchItem.TransliterateFlags"
args2(16).Value = 1280
args2(17).Name = "SearchItem.Command"
args2(17).Value = 3

dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args2())

end sub

Comment 14 Mechtilde 2008-01-18 15:09:34 UTC
now (Version 2.3.1) it works for me with sums
Comment 15 Mechtilde 2008-01-18 15:11:47 UTC
-> closed