metamodel (#7) - Can't parse double from query (#112) - Message List
I'm running a query, and one of the results I need is the double value 1.1. The value resides in a column which is of type VARCHAR (I used columns.getType() to find out the type)
However, after running the query, the output I get is 1,1
The decimal point is replaced with the comma. Is this because of the column type?
I'm printing out the value on the console using:
"System.out.println(dataset.getRow().getValue(0).toString());"
And I'm parsing the double using the Double.parseDouble() method.
Has this occurred to anyone before? I can provide the excel file if needed. I'm using MetaModel 1.2
-
Message #436
Hi kshah,
What is the type of value that you are getting? You can tell me this by running:
System.out.println("I'm getting: " + dataset.getRow().getValue(0).getClass().getName());
kasper03/15/10 23:33:21 -
Message #437
I'm getting: java.lang.String
kshah03/16/10 17:48:06 -
Message #438
I was just investigating the code and it seems that all numeric values are passed through a number formatter and returned as a string in stead of as the "real" number-value. I guess we need to fix this as it's technically a bug.
As a workaround you can use:
NumberFormat nf = FormatHelper.getUiNumberFormat(); Number number = nf.parse(dataset.getRow().getValue(0));
kasper03/16/10 18:02:24 -
Message #439
OK, works great. Thanks.
kshah03/23/10 17:00:49
