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!

Crystal function similar to Oracle's LPad? 2

Status
Not open for further replies.

darwin101

Programmer
Mar 7, 2001
156
0
0
US
Is there a function in Crystal which serves the purpose of lpad in Oracle?

lpad(x , 8 , '0') would return x always as a string of 8 characters even if it's original length is less. 0 will be appended to it's left if it is of shorter lenght.

Thanks :)
 
You could use:

totext({table.number},"00000000")

This would create an 8-digit string with zero's padding the number to the left. Adjust the number of zero's to control the length of the string.

-LB
 
You could also use:

totext({table.number},replicatestring('0',8))
or even replace '8' with a global variable in order to be able to easily change the format but altering the variable's value, especially when using various formula fields that contain this expression.

 
Thanks to you both. The field is a string, I had to use only part of it then convert it to number then back to string.
totext(tonumber(right({Authorization No},8)),"00000000")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top