Hi All,
I have a scenario where I get the number of decimal points dynamically.
For example:
If the incoming column value for C1 is 2 then C2 must be multipled by C2*0.01
If the incoming column value for C1 is 4 then C2 must be multipled by C2*0.0001
Basically i need to multiple C2 in this way
C2 * (1/10 ^C1 value)
Any suggestions on how to implement this logic?
-Thanks
Dynamic Decimal Point
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 247
- Joined: Thu Apr 27, 2006 6:38 am
- Location: Hyderabad
Looks like C1 is a column on the incoming data, correct? And it can change from record to record?
Assuming so:
a) If C2 is a string, just use Left(), Right(), Len(), '.' and a little math to insert the decimal point
b) If C2 is a decimal, use the Pwr() function, as in MyValue = Pwr(10,C1), then C2 = C2 / MyValue
Regards,
Assuming so:
a) If C2 is a string, just use Left(), Right(), Len(), '.' and a little math to insert the decimal point
b) If C2 is a decimal, use the Pwr() function, as in MyValue = Pwr(10,C1), then C2 = C2 / MyValue
Regards,
- james wiles
All generalizations are false, including this one - Mark Twain.
All generalizations are false, including this one - Mark Twain.
-
- Participant
- Posts: 247
- Joined: Thu Apr 27, 2006 6:38 am
- Location: Hyderabad