×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# To Remove Decimal in Amount field

## To Remove Decimal in Amount field

(OP)
I have Amount field which have value as below say
148.90,148.99
Requirement is to remove the decimal and left pad with zero's.Precision is 9

Value 148.99 is converted correctly as 000014899 but coming to 148.90 its displaying as 000001489, but testers claims it to be
000014890

When we convert a number removing decimal there is no value for 0 i.e. it takes value 148.90 as 148.9 so while removing and left padding its displaying as 000001489.

Kindly help me with the situation

### RE: To Remove Decimal in Amount field

1. Multiply by 100
2. Cast to integer
3. Cast to string

?

Ties Blom

### RE: To Remove Decimal in Amount field

(OP)
Input precision is 19 and scale is 4.
i am taking it i am taking it as precision 9 and scale 2
Then o/p is coming as say 1239.9000 or 13456.000 so if it is the case i should get number as 000123990 and 001345600
Including digit it is taking number upto 9 length.
In this case how can we multiply with 100

Kindly suggest

### RE: To Remove Decimal in Amount field

How are you doing this conversion?
How is your input represented? Is it decimal, float, implied decimal, string, etc?
and your output is implied decimal point of 2 in a string format?

"I think we're all Bozos on this bus!" - Firesign Theatre

### RE: To Remove Decimal in Amount field

(OP)
My input is to add two amounts and datatype is decimal with precision 19 and scale 4 for both amounts.

Output should be length 9 with padded to zeroes.

Example:

benededuct (benededuct:Double:): "1500.000000000000"
maxoutaccrual (maxoutaccrual:Double:): "3600.000000000000"
accumvalue1_v (accumvalue1_v:Double:): "101.5000000000000"
accumvalue2_v (accumvalue2_v:Double:): "752.0000000000000"
accumvalue3_v (accumvalue3_v:Double:): "1000.500000000000"
DeductibleAmt_V0 (DeductibleAmt_V0:Double:): "1601.500000000000"
CopayMOPSAmt_v0 (CopayMOPSAmt_v0:Double:): "4352.000000000000"

Maxoutaccrual+accumvalue2

### RE: To Remove Decimal in Amount field

(OP)
IIF(instr(TO_CHAR(DeductibleAmt_V0),'.')>0,TO_CHAR(DeductibleAmt_V0*100),TO_CHAR(DeductibleAmt_V0))

I have used the above Expression

and amoounts for amounts like 160150 is displaying correctly but value 4352 is supposed to be 435200
but it is displaying as 4352 only

### RE: To Remove Decimal in Amount field

"I think we're all Bozos on this bus!" - Firesign Theatre

### RE: To Remove Decimal in Amount field

(OP)
According to above logic, it should work for amount like 4352.000000 also but it is displaying 4352

### RE: To Remove Decimal in Amount field

Your expression is saying if there is a decimal point, then append two zeroes, otherwise just display the same number (without zero pad).

If you do what Ties suggested, you would always multiply by 100, which gives you the trailing zeroes. Once it's converted to integer, you will drop any extra digits past the decimal. Then convert to string and left pad. No need to check for a decimal point.

"I think we're all Bozos on this bus!" - Firesign Theatre

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!