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

Need to Add Leading Zeros

Status
Not open for further replies.

kc27

Technical User
Sep 10, 2008
171
US
I have a report that concatenates department numbers and department names.

The department numbers can be from one to three digits. I would like to add leading zeros to the one and two digit department numbers so that all department numbers are three digits.

Below is the formula that I am using. The second line where the department number and name are concatenated works fine, but the line I added above it to add the leading zeros to the department number does not.

Can someone point me in the right direction to get this working?

Thanks in advance for any help on this.

format(dept.dept_nbr,"###") +
{dept.dept_nbr}& " " & {dept.dept_nm}
 


hi,
[tt]
format(dept.dept_nbr,"000") & {dept.dept_nm}
[/tt]

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Assuming that your department number is numberic or can be converted to a number, try this:

totext({dept.dept_nbr},"000")

Howard Hammerman,
Crystal Training and Crystal Material
On-site classes and one-on-one coaching
Low-cost telephone/email support
FREE independent Crystal newsletter
howard@hammerman.com
800-783-2269
 
Thanks for the help Skip and Howard, I really appreciate it. Below is what ended up working for me.

Kenn

totext({dept.dept_nbr},"000")& " " & {dept.dept_nm}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top