TIP Adding numeric data types with fixed precision
Posted: Sun May 08, 2016 11:16 am
(Tip for Servoy beginners...)
When creating a numeric field inside Servoy, you get 'double precision' in Postgres.
For business applications, e.g. ERP or accounting systems, you want to avoid the default data type 'double precision', as that will lead to problems as some numeric values will be represented like 3.60999999997 or something like that.
Solution:
(1) Open an SQL editor and send the following line to add a numeric field with exactly two decimal places
ALTER TABLE posting_lines ADD COLUMN pli_credit_amount numeric(15,2)
(2) In Servoy, right click on the database, use 'Synchronise with DB Server information', and let Servoy add the new field to the Database Information File.
When creating a numeric field inside Servoy, you get 'double precision' in Postgres.
For business applications, e.g. ERP or accounting systems, you want to avoid the default data type 'double precision', as that will lead to problems as some numeric values will be represented like 3.60999999997 or something like that.
Solution:
(1) Open an SQL editor and send the following line to add a numeric field with exactly two decimal places
ALTER TABLE posting_lines ADD COLUMN pli_credit_amount numeric(15,2)
(2) In Servoy, right click on the database, use 'Synchronise with DB Server information', and let Servoy add the new field to the Database Information File.