Skip to Content
0
Former Member
Nov 07, 2006 at 01:16 PM

Number of decimals

43 Views

Hi all,

My requirement is :

I have a CHAR field (FIELD1) which would have values like 23.45, 12.3456.........

Now I have another field (FIELD2) which has the number of decimal places I need to care about.

For example -

If FIELD2 has '1' and FIELD1 has a value of '23.45' then I should overwrite FIELD1 value with '23.4'.

Similarly if FIELD2 has '2' and FIELD1 has '12.3456' then I should overwrite FIELD1 value with '12.34'.

And mind you if have '2' in FIELD2 and if FIELD1 has '2' then I should overwrite FIELD1 value with '2.00'.

I will summarize it again,

FIELD2   FIELD1   FIELD1
-------------------------
1        23.45    23.4
2        12.3456  12.34
2        2        2.00
0        12.34    12  

Can someone help me with some logic to get around this issue. I would be more than happy to award full points.

Waiting for your replies...