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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Leading Zeros 1

Status
Not open for further replies.

Snookless

Technical User
Mar 17, 2003
34
BR
Hello all,
A little help please ....numaric field up to 10 characters, if the number is "1" I would like to see "0000000001", if the number is "60000" then "0000060000" and so on.....how can I accomplish this?
Snookless
 
Here's one way:

if len(totext({yournumberfield},0)) < 10 then Replace(Space(10-len(totext({yournumberfield},0)))+totext({yournumberfield},0),&quot; &quot;,&quot;0&quot;) else totext({yournumberfield},0)

-LB
 
LB..unable to verify formula &quot;Too many arguments have been given to this function&quot; is the message that I recieve...any other Ideas?
Thank you
 
you either have one too many or one too few parentheses here:

totext({yournumberfield},0),&quot; &quot;,&quot;0&quot;)
 
Snookless,

Please try copying and pasting my formula and then substitute your own field. This works--I just rechecked--and that's what I did originally--copy and paste.

Pelajhia--I can see why you'd think that, but the

,&quot; &quot;,&quot;0&quot;)// after

+totext({yournumberfield},0) // is the end of the replace function, not the totext function.

-LB
 
You are correct, I should have known.Thank you so much for your help.
by the way...what is &quot;Pelajhia&quot;?
 
Another alternative is to use:

Totext ( {field}, &quot;0000000000&quot; )

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top