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

Fill in field with leading 0's 3

Status
Not open for further replies.

riverame

IS-IT--Management
Jan 23, 2002
3
US
I am trying to bring in some fields that need to be a fixed length. For example, I have invoice number 2598 and it needs to be 15 chars long with leading 0's in my report. I have tried several formulas and I either get all 0's or nothing. Can anyone help me, Please? Thank you in advance.
 
Create the following formula (replace {order.number}with the field you want to convert to 15 characters):

If order number field is a number:
ReplicateString ("0", 15-length(totext({order.number},0,""))) & totext({order.number},0,"")

If order number field is a string:
ReplicateString ("0", 15-length({order.number})) & {order.number} Mike

 
thanks, I just figured that out, but I am new to this forum and it looks like my response got posted to the next thread. Thanks for the info. I appreciate it.
 
Bruce-

Are you saying the argument in the totext() function works like the picture() function? This is all news (and good news) to me. Software Support for Sage Mas90, Macola, Crystal Reports, Goldmine and MS Office
 
Yes, that is it exactly. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top