Storing exceptionally large or small numbers

Certified Senior Developer

I am using an integration to grab a bunch of numbers from an external source. Most of the numbers are fine, but some are exceptionally large or small to the point that they come in in scientific notation. Examples include: 

 2.2141276E - 5

and 

2.1383022233807285E11

Both of these numbers give me separate errors. For the first, I'm getting an "invalid double value", which I seems to be due to the spaces in there so I need to I guess strip the spaces, despite it not being a string? I think one way or another I can find a way to deal with that. But the other error I get is when actually writing to the database. I keep getting an "Out of range value" error despite having set the db field to accept 20 digits. 

  Discussion posts and replies are publicly visible

Parents
  • Can you clarify if the value received from the integration is already in scientific notation or if Appian is just displaying it that way? For instance, is the value received from the integration literally "2.2141276E - 5"? If that value is actually being returned from the source, you should be able to strip spaces and do a conversion to a deccimal type first before writing the results, and then it should work.

    Try something like this:

    todecimal(stripwith(ri!value, " "))

    The other thing to keep in mind is that while your data has precision up to 20 digits, in general Appian does not support that level of precision since the decimal in Appian is double precision. See this knowledge base article for more information. This means that in some scenarios it may be better to actually store the data in the database as text to ensure that you don't lose any precision.

  • 0
    Certified Senior Developer
    in reply to Peter Lewis

    Perfect, that's what I needed. And yes, it comes in from the integration that way, not Appian. 

Reply Children
No Data