377
Views
6
Comments
How to save decimal digits over length 8?

Hi,

I want to save decimal values of length more than '8' digits, using "decimal" data type limits to only '8' characters while saving to db. Please advise how to increase the limit to 12 digits.


Regards,

Pujitha

2022-08-03 04-32-50
Ravi Punjwani

Hi Pujitha,

The default Decimal type won't allow more than 8, as you can see the error message when you try to configure anything more than 8.


If this is a hard requirement, then you can consider storing them as Text.

May I ask what is such a data which require more than 8 decimals?

2020-09-21 08-42-47
Vincent Koning

Hi Pujitha,

8 digits is the max that OutSystems will support (or allow for that matter). You can check this on the following documentation page: https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Data/Data_Types/Available_Data_Types

If this does not suit your needs I would take this up with your CSM or Sales person within OutSystems. 

Greetings,

Vincent

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi @Pujitha Chalasani ,

alternative to using text, you could also store your information in a different order of magnitude and have getter / setter wrappers to do the divisions / multiplication correctly to make sure value is understood correctly in all your application.  For example, if you need 12, multiply by 10000 on updates and divide by 10000 on retrieval.

This leaves the ability to calculate and sort with them intact.

(so I wouldn't make such an entity public at all, to avoid people making wrong assumptions in their aggregates.)

Dorine

2022-08-03 04-32-50
Ravi Punjwani

Hi Dorine,

Sorting might work well in your suggestion, but calculations would only be supported partially because dividing them by 10000 may increase the decimal precision required. For anything over 8 digits, the remaining value would be truncated which may return an incorrect value.

However, this idea would at least support it to be still be treated as numbers (which is great).

I would recommend using 8-digit decimal type so to have full decimal for the main value, and just keep 2 remaining decimal points in a separate number or decimal field, so those can only be used to concat or display. This will save a lot of overheads on calculation since most part of decimals would be still covered in the main decimal value. All of it only if numeric operations such as sorting, basic math operations are required.

If no mathematical operations are required, then Text type may also seem alright to avoid any pre and post processing.

2021-09-06 15-09-53
Dorine Boudry
 
MVP

i think the 8 digits is an entity attribute limitation, variables in the application can be much more precise (probably 28 digits?) so there would not soon be truncation if OP is in need of 12 digits (I'm assuming he did do proper analysis of how precise things need to be)



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.