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!

Add Digits to a set Length 2

Status
Not open for further replies.

rwn

Technical User
Dec 14, 2002
420
US
I have a formula @PartNumber which is (Job.PartNumber) and if the Part Number is less than 15 digits, I need to add as a prefix Zero's.

For example, the Part Number is: 1480-7865-01. This is 12 digits in length. So 3 Zero's must be added and show as follows: 0001480-7865-01.

Can this be done? Thank you!
 
stringvar x := {table.field};
if len(x)<15 then
replicatestring("0",15-len(x))+x else
x

-LB
 
ToText({Job.Part_Number},"000000000000000")
This formula exhibits an error: To many arguments have been given.
 
That's because it is already a string. Did you try my suggestion?

-LB
 
It's alpha mimetic. But thank you, I can use for the future.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top