I have several decimal fields in one database with a precision of 15 and a scale of 3 (DECIMAL (15,3)).
On my interface if I put a decimal with more than 12 precision digits the node Write to Data Store Entity is always failing. I already tested using a floatingpointfield and also a textfield (where I converted the text do decimal only to persisting purposes) to understand why this is happening.
Do you have any ideas how to overcome this? Because I need to consider decimal numbers up to 15 precision digits .
Discussion posts and replies are publicly visible
You could possibly use the fixed function to get exactly 12 decimal places after a number, but the output will be a Text, and your XSD will have to cast the text directly into the DECIMAL type without going through Appian types. 15 significant digits is about the absolute limit of the Decimal type Appian uses, but also for reasons they always convert especially precise figures into scientific notation. You have to use the fixed() function to get rid of the scientific notation.
If that doesn't work, you'll need to build a custom Math plugin in Java or see if one is available from the AppMarket. The Java will have to write to your DB if fixed() doesn't cut it.
Hello. Thank you for your reply. I think you misunderstood my question.
In general I have the following:
- a textField when I want to put a value like this: 123123123123123.23 (15 digits before the decimal point). After this, I cast the value to a decimal value in order to save this value into a CDT with a decimal field.
- However, this is only working for numbers up to 12 digits before the decimal point. If I consider 15 digits (like the previous number) the Write to Data Store Entity will always fail.
- With this number "123123123123.24" the process works because I have a decimal number with 12 digits, however if I put "123123123123123.23" the process will fail because right now I have 15 digits (before the decimal point).
Do you have any idea why this is happening ?
double tpye has 15 digits of precision that includes all digits before and after the point. plase take a look https://docs.appian.com/suite/help/20.2/Appian_Data_Types.html#number-decimal
For PVs, if you enter a number that exceeds the maximum number of digits supported by double precision floating-points, the number is truncated down to the maximum number of digits when you save the process model. It does not provide you with a warning message if this occurs.
have you tried spliting the value in several cdt fields?
Per your description it's because the number is too large to be represented as a Decimal.
I also think you may misunderstand how the DECIMAL() type of the MySQL / ORACLE works. I thought you had 3 digits before decimal, and 15 total. 17 total is more than a Decimal can hold.
© 2024 Appian. All rights reserved.