Querying Database With Large Decimal

Im having an issue where if I have a large decimal that I am using in my queryFilter to query the database with, the query crashes.

a!queryFilter(
field: "minDevCost",
operator: "<=",
value: ri!devCost
),
a!queryFilter(
field: "maxDevCost",
operator: ">=",
value: ri!devCost
)

The CDT field is a numeric (Decimal).

If I enter in a decimal of 9000000000, the query crashes.
if I enter in a decimal of 9000000000.00, then the query processes fine.

However, I cannot force the number to have 2 decimal places as if I use the text function
text(9000000000, "###############.##")
I get back N/A

I tried the fixed function as well and this did not work.

Any other suggestions to get this to work?

OriginalPostID-257369

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    @benjamin it's the issue of range of number, as Appian build on top of Java, hence as per Java, the range of number is between -2,147,483,648 to 2,147,483,647,
    So as per this, I think the value which you are passing, is exceeding the range and hence you are facing issue

    Try entering the max range value as input as mentioned above I.e. 2,147,483,647, and check whether it's working or not. Even the value entered by you just exceeding a bit as we the range of int, try passing the max range value, and let us know if still facing the same issue
  • Just adding to the previous comment, in this case though, storing the decimal places requires more space, eg storing 1 compared to 1.1234567, so applying that to 9000000000, 9000000000.00 is not the same and needs more 'space', to which it exceeds the limit.
  • You've exceeded the limit of Appian Integer value, which renders infinity, but you're still well within the limits of 15 or so significant digits for a double precision floating point. Your issue is Appian automatically assuming any value without a decimal part is not a decimal, interpreting your number as an integer and setting it to infinity.

    You probably want to make absolutely sure that you cast this value as a decimal type when defining it. Something like:

    value: todecimal(ri!devCost)

    I hope this helps.
  • It seems the java range has not changed.  We have a query that returns an error "Expression evaluation error at function a!queryEntity: An error occurred while retrieving the data. Details: Unexpected error executing query (type..." when the numbers are larger than the above it works up to 2,147,483,647 - the data type on the number is double.  Is there anything else that can be done here that will allow the query to work?  It works fine if the value is divided on the DB?

  • 0
    Certified Senior Developer
    in reply to leslies331

    Why not using a string if the integer limit is exceeded?