Appending a field with a result of more thn 6 decimals

5 posts / 0 new
Last post
bbaburaj
Offline
Joined: 10/26/2016 - 05:56
Appending a field with a result of more thn 6 decimals

What is teh best way to get a calculated result within a column with more than 6 decimal.
I have a column and i need to devide the amounts in that column by 0.1234564879 and need teh results of delimal atleast 15 digits. . When i tried this, i am getting teh results as 0.00 as the digits are more than 6 and till 6 digits, most of the values are zeros. I can not change any fields into thousands or millions. Please let em know if this can be possible.
Thanks,
Bibin

Brian Element's picture
Brian Element
Online
Joined: 07/11/2012 - 19:57

Hi Bibin,

Well to do this you have to trick IDEA into doing what you want.  As you probably notice that numeric fields only capture 6 decimals.  If you want to show 15 you need to do the calculation and then turn the result into a character field.

So create a virtual character field and make sure it is long enough to hold the result, maybe 25 characters or so.  The in your equation enter the following:

@str(AMOUNT * 0.123456789, 20, 15)

and you will have your 15 decimals.

Hopefully this helps you out.

Brian

bbaburaj
Offline
Joined: 10/26/2016 - 05:56

Yeah,  thisbis working butbthe problem is i have to do one more calculation based on the newly created column. Since the created column is in character format,  would that be possible? ? 

Brian Element's picture
Brian Element
Online
Joined: 07/11/2012 - 19:57

You would need to put the @val() around the string before using it in the calculation and then use the @str to save all the decimals.  I just tried it and it seems to work, I would make sure to validate your results when doing this to make sure you are getting what you are expecting.

So assuming that the above you created an AMOUNT_STR field then the equation would be:

@str(@Val(AMOUNT_STR / 25, 30, 15) 

If I wanted to then divide by 25.

bbaburaj
Offline
Joined: 10/26/2016 - 05:56

Hi Brian,
Thank you for your reply. It really worked. Thank you very much.
Regards,
Bibin