cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Decimal Conversion After Upgrading @sap/cds from 7.9.3 to 8.0.3

sureshl85
Newcomer
0 Kudos
270

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!

 

katan_patel
Participant
0 Kudos

Ignore this comment.  I accidentally used a comment instead of answer and now can't delete it.  I've put my answer below

Accepted Solutions (0)

Answers (1)

Answers (1)

katan_patel
Participant

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.  

katan_patel_0-1721693385394.png

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