Datasource from dataset and decimal rounding [SOLVED]

Don’t know if this is the right section, but it seemed like the only suitable one to me :D

Anyway, I’ve got this little annoying problem that is driving me crazy. Basically I’ve got a db function which creates a table on the fly; this table has a ‘value’ column which is casted from within the db to decimal(12,5). Ok, I call this function and get a dataset from Servoy, then create the datasource, assign it to a cloned form, later assigning data providers to single fields within the form.
All goes fine until something happens when the ‘value’ column from the dataset is assigned to the linked field: despite the field returned by the function being a decimal with at least five decimal places, Servoy decides to round the value to the nearest integer when displaying the form, i.e. a number like 123.456789 suddenly becomes 124 (or 123, don’t exactly remember, that’s not the point). I’ve also tried passing to the createDataSource method the array of types to use but nothing changed.

Any idea what’s happening? Am I doing something wrong?

EDIT: apparently, declaring the types array on multiple lines did not please servoy, while rewriting it on a single line seemed to do the job. I hope this helps ;)

Please more information :

  • Servoy version
  • Database type and version

Can you reproduce it in an small solution with some data and export it ?

Servoy developer Version: 6.0.1 - build 1219
Microsoft SQLServer 2000 (8.00.760)

As for the sample solution I’ll try and let you know ;)

P.S.: I must add (maybe it was not too clear from the previous post) that at least 'till when loaded into the dataset all the decimal places are retained, so for example I can see a value like 1.23456 within the dataset. The problem seems to stem from the binding operation itself, at least from what I can tell.

Ok I created the solution and the database and it seems I’m doing something wrong when creating the datasource. If I pass the array of datatypes then the decimals display correctly. The fact is I seem to remember to have done the exact same thing in my application…probably I forgot something ;)

EDIT: Whoops, I passed a JSColumn.TEXT instead of a NUMBER, damn cut&paste :D

Many thanks anyway.

I’m back :D

This time I’ve got a similar problem, but I cannot manage to solve it in any way. I still have a dataset returned by a query which executes a function. Then I create a datasource passing the following types

[
  JSColumn.TEXT,
 ,JSColumn.TEXT
 ,JSColumn.NUMBER
 ,JSColumn.DATETIME
 ,JSColumn.INTEGER
 ,JSColumn.TEXT
 ,JSColumn.INTEGER
]

However I keep receiving the following error message

Exception Object: com.servoy.j2db.dataprocessing.DataException: incompatible data type in conversion
MSG: incompatible data type in conversion
is a ServoyException
Errorcode: 100
Failed to execute the method of context null and name openElementiDetails on the solution studiomiazzo
 > com.servoy.j2db.dataprocessing.DataException: incompatible data type in conversion

I’ve also tried to create a temp view into the database, populated by executing the function directly and then load it into servoy to see what kind of datatype it was expecting. The fact is these are exactly the same I’m passing when creating the datasource.
I’m using Servoy 6.0.4 and SQL Server 2000.

Thanks in advance.

Any idea anyone?