cancel
Showing results for 
Search instead for 
Did you mean: 

SELECT changes Query Parameter

Swadhin
Explorer
0 Kudos

My Query Parameter value is changed automatically ... here is the example to reproduce ...

cds repl
(SELECT.from("Payments").where({PaymentSeq: 26177172834098309})).SELECT.where[2].val

// Expected 26177172834098309, not 26177172834098308

As you can see the returned value is 1 less than the one I provided as input.
View Entire Topic
Swadhin
Explorer
0 Kudos

Hi andre96,

Thanks for the clarification and also the reference. It helps a lot in understanding the issue, but I am not sure what's the best way to resolve it in my case. I am calling an external API (OData V4) and trying to use `cds.connect.to` for consumption. Do you happen to know the right way to resolve it apart from third-party library (fetch/axios) or natively calling the API?

andre96
Advisor
Advisor

Hi, I'm not familiar with that and can't help here. But just a heads up: If the requests use JSON (which they likely do), then you have the same issue as with JavaScript: Your number is not safe. You could try to send the number as a string and see what response you get. However, if the external API only accepts numbers and also only accepts JSON (instead of e.g. XML), then it may be worth to contact the external service. Even big platforms such as Twitter ran into this issue, see for example https://developer.twitter.com/en/docs/twitter-ids : Twitter additionally sends `id_str`.