on 2024 Jul 18 2:59 PM
I've recently upgraded @Sap/cds from version 7.9.3 to 8.0.3 and encountered an issue with Decimal conversion. Specifically, I'm getting the following error:
"Value is not a valid Decimal"
I referred to the CAP release notes for June 2024 and followed the instructions to enable the new ieee754compatible feature as mentioned
https://cap.cloud.sap/docs/releases/jun24#new-option-cds-features-ieee754compatible
Here's what I added to my package.json file:
"cds": {
"features": {
"ieee754compatible": true
}
}
Despite this, I'm still facing the same issue. Has anyone else experienced this problem or have any suggestions on how to resolve it?
Thanks in advance for your help!
Hi Suresh, As per the release notes you referenced. By turning the flag on enforces that the data type returned is a String and your code is expecting a Decimal.
Without this setting enabled it is relative to the DB the behaviour. With this setting enable guarantees consistent behaviour regardless of db.
If you require a Decimal, one option you could use it to convert the String to a Decimal via parseFloat.
parseFloat() - JavaScript | MDN (mozilla.org)
Thanks,
Katan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
62 | |
12 | |
7 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.