Decimal places rounding differences

In the past, I have always rounded decimal places before saving them to avoid errors.
My colleague has now written data into a foundset without rounding beforehand and in my opinion it should be a bug in Servoy:

We have an SQL database with a numeric field (17.5). So only 5 decimal places are allowed.
In Servoy I can assign the value 0.23456789 and I can see the value in the result list. Normally the value should be truncated or set to a fixed value as specified in the database, I think.

Example:

=>databaseManager.setAutoSave(true)
true
=>forms.xyz.foundset.curr_factor_eur = 0.23456789
0.23456789 <---- FALSE, must be 0.23457

=>var fs1 = datasources.db.boss_sql.table1.getFoundSet()
=>fs1.loadAllRecords()
true
=>fs1.curr_factor_eur
0.23456789 <---- FALSE, must be 0.23457

=>databaseManager.refreshRecordFromDatabase(fs1,1)
true
=>fs1.curr_factor_eur
0.23457 <---- CORRECT

Is it intentional and he actually has to use .fixed() before inserting it to the foundset or is it a bug?

If you insert into SQLtable values (…, 0.23456789, …) SQL Server will correctly round it to 0.23457.
If you need it to display “correctly” in the foundset before it is saved I think it’s up to you to round it.
Other users may prefer the default behaviour.

John

Hello John,
but the value is already stored (databaseManager.setAutoSave(true) and databaseManager.saveData make no difference).
Servoy caches the original value in the foundset instead of updating the corrected stored value in the foundset.

OIC. I had missed that. We run with setAutoSave(false).
I’ll shut up now and wait to see what more knowledgeable folks have to say.
John