Which Format or Data Type?

  • Thread starter Thread starter JustMe
  • Start date Start date
J

JustMe

Could Someone PLease advise me on this?

I have a table with fields set.


FieldName Data Type Format Decimal Places Default Value
BASERATEAMT Currency Currency 5 0.07210
FLATCONNRATE Currency Currency 2 10.00
PWRCOSTRECOVER Curency Currency 7 0.0085000

My problem is when I enter what is supposed to be the default values
for these fields, suddenly they will NOT hold the values entered.

0.07120 becomes 0.0721
10.00 becomes 10
0.0085000 becomes 0.00850

I understand the last zeros are being droped but what steps would I use to
keep the zeros because these are used for computations in a total.

Would I use a text field and use quote marks to keep the zeros?
How would I then convert this to currency format for adding then togather
for a total sumation?

Thank you for assisting
 
Currency fields only have 4 decimal places allowed.

However, you example you have so far looks just fine:

0.07120 = 0.0721 = 0.0721000000000000000000

I mean, really, the extra zeros don't mean anything.

What have a default value of

0.0085000

Why not use:

0.0085

In all your examples, you only have 4 digits of precision.

If it is desired that you need more then 4 digits..then yes..I see your
point. You can do one of to things:

You could use a field type of "double".

If you cannot incur any type of rounding errors, then you need to use
currency, and simply SCALE the values you store by 100, or perhaps 1000.

This means that all numbers are stored as 100 times their value. You do all
the math, and then de-scale the results.

So, just remember that currency is limited to 4 digits after the decimal
place. If you need more..then you either scale results...or use double data
type (but, the double data type does incur rounding errors).
 
Back
Top