Posted: 20 Feb 2020 9:37 EST Last activity: 21 Feb 2020 10:12 EST
Double precision issue.
I am currently working Pega 8.3 using the smart claims framework.
I have an issue we are facing here on the team. I am trying to set a double value without precision if there is no decimal values.
My team wants the clipboard to display the value without a decimal like this
and not like this 1000.0
When I hard code a value to a double it works perfectly fine. But, when I apply a property to the value I am setting I get a trailing 0 always. Is there anyway around this?
All property types behave this way string, int, double so if I try to cast what I am setting as those it is still behaving similarly.
It is necessary for us to use double as we need a property that can handle big int datatype in the back end. I can solve this issue with the decimal property type, but, that does not solve our requirement.
What is the consequence of the clipboard showing the .0 ? The clipboard is merely a way of showing what data is held in memory. The .0 is indicative of a Decimal data type but the number under the covers is still 1000.
As this is a numeric field, either:
It is an input to another numeric calculation, in which case the trailing .0 surely has no impact (it is internally managed as a number); or
You eventually want to show it on a UI, persist it to a data store in an Integer data type, or serialize it into an API message where perhaps is where the .0 is less desirable.
For the second point, consider the formatNumber Control (for UI presentation) or the pxFormatNumber Function to create a string representation of the number that omits the decimal places, if you are sure it is always .0
We will not be using it in UI. It is simply a request from business. I understand how impractical it is. Just wondering if there was a solution as to why hard coding results in one result versus calculated property returning another.
We are using it a batch identification. The only reason we are using double is because it is replacing a big int data type. No other pega data type will cover the range of big int.