Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

converting amount to string 2

Status
Not open for further replies.

lymi6977

IS-IT--Management
Jan 14, 2005
16
0
0
US
I need to convert an amount to a fixed string of 15 characters with leading zeros.
I had this working when I did not need to include decimal places. Now, I have to include the full amount.

Example: 1457.70 was 000000000001457

I need it to show as 000000000145770. I must have missed something in a formula, because it keeps dropping the decimal amounts.

Can you help?
 
Hi,
In your formula, remove the decimal point first with the
Replace({fieldname}.".","") function, then format the result as desired..




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
lymi6977,

I am trying to do this exact thing (convert a number to a zero padded value). How exactly did you do it? I tried using the Formatting option on the number, and also tried writing a Custom Function (which I have never tried before), and had no luck.
 
I think the usual is something like:

replace(totext({table.field},"000000000"),".","")

This assumes that you are doing the exact same thing and dropping the decimal.

-k

 
synapsevampire,
Thanks for replying. I actually saw another post you replied to, and used the logic you used there to come up with this:

ToText({#Total_Check_Amt}*100,"000000000000000")

The only problem is, the original field is a currency field, and I am getting a dollar sign before my value. Can I easily remove it without having to use the Right or Mid functions (it doesn't seem to give me the option to change the format of the calculated field)?
 
If not, don't worry about it. I can use the Right function,

Right(ToText({#Total_Check_Amt}*100,"000000000000000"),15)

I just thought I might be overlooking something obvious.
 
You could use:

ToText(tonumber({#Total_Check_Amt})*100,"000000000000000")

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top