Hi,
We have a MySQL 5.5.13 in which a table (which happens to use the InnoDB engine) has fields which are of type:
decimal(19,10).
That is, a precision of 19; a scale of 10.
When we use Visual Builder to create a datasource definition form this file, it translates this field to a type of "number", as in:
<field name="c_terminalResidueModificationMass" type="number"/>
However, in our SmartGWT client side code, we have discovered that "number" is not a supported field type. That is, the code below will return NULL for the formItemType.
FormItem currentFormItem2 = event.getItem();
String formItemType = currentFormItem2.getType();
Furthermore, the javadocs for fieldstype (http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/types/FieldType.html) do NOT have a type of "number".
1) So, our first question is: is this a bug?
2) Secondly, what type should be used for decimal values?
So, what we did was the we simply changed the datasource definition to float; this worked, except for the following problem:
In our dynamic form, we can set a "float" (ie what was supposed to be a decimal field) field to some nice value, such as 1.23456789
However, when we try to retrieve the value in that dynamicform formitem though the code listed below, it TRUNCATES/ROUNDS the value that the user keyed in (without any warning).
FormItem currentFormItem2 = event.getItem();
....
currentFormItemValue = currentFormItem2.getValue();
...
System.out.println("The decimal is (from set)" + currentFormItemValue.toString() );
3) So, our third question is: is there a way to prevent float from truncating/rounding values that a user keys in?
Until we hear otherwise, the only hack we're thinking about implementing is to make the datasource definition as "any", and then internally have our code assume that "any" really means "decimal", and to then convert the "any" field to a string and continue with rest of the code. (But, we would then lose the *automatic/prebuilt* validation for a numeric field).
It seems like SmartGWT probably either does support a decimal field and/or has a way of prevent rounding/truncation of floats.
Any thoughts would be appreciated. Further operational details are below:
========
OS: Windows XP Pro
IDE: MyEclipse 9.0 with Google Plugin for Eclipse (2.3.1)
SmartGWT EE 2.4
Browwer: Mozilla Firefox 4.0.1
GWT SDK: 2.2
Sun JDK 1.6.0_13
We have a MySQL 5.5.13 in which a table (which happens to use the InnoDB engine) has fields which are of type:
decimal(19,10).
That is, a precision of 19; a scale of 10.
When we use Visual Builder to create a datasource definition form this file, it translates this field to a type of "number", as in:
<field name="c_terminalResidueModificationMass" type="number"/>
However, in our SmartGWT client side code, we have discovered that "number" is not a supported field type. That is, the code below will return NULL for the formItemType.
FormItem currentFormItem2 = event.getItem();
String formItemType = currentFormItem2.getType();
Furthermore, the javadocs for fieldstype (http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/types/FieldType.html) do NOT have a type of "number".
1) So, our first question is: is this a bug?
2) Secondly, what type should be used for decimal values?
So, what we did was the we simply changed the datasource definition to float; this worked, except for the following problem:
In our dynamic form, we can set a "float" (ie what was supposed to be a decimal field) field to some nice value, such as 1.23456789
However, when we try to retrieve the value in that dynamicform formitem though the code listed below, it TRUNCATES/ROUNDS the value that the user keyed in (without any warning).
FormItem currentFormItem2 = event.getItem();
....
currentFormItemValue = currentFormItem2.getValue();
...
System.out.println("The decimal is (from set)" + currentFormItemValue.toString() );
3) So, our third question is: is there a way to prevent float from truncating/rounding values that a user keys in?
Until we hear otherwise, the only hack we're thinking about implementing is to make the datasource definition as "any", and then internally have our code assume that "any" really means "decimal", and to then convert the "any" field to a string and continue with rest of the code. (But, we would then lose the *automatic/prebuilt* validation for a numeric field).
It seems like SmartGWT probably either does support a decimal field and/or has a way of prevent rounding/truncation of floats.
Any thoughts would be appreciated. Further operational details are below:
========
OS: Windows XP Pro
IDE: MyEclipse 9.0 with Google Plugin for Eclipse (2.3.1)
SmartGWT EE 2.4
Browwer: Mozilla Firefox 4.0.1
GWT SDK: 2.2
Sun JDK 1.6.0_13
Comment