Click here to Skip to main content
15,903,203 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Crystal report using VS2010. I am trying a to create a formula for the following scenario:

x = any number (Fixed number of 8 digits, cant be less or greater)

If Length of X is less than 8, pad the required amount of 0's in the front to make its length 8. Result should also be a number and not a string.

Eg:

X = 123
Result of Formula should be 00000123

X = 9
Result of Formula should be 00000009
Any help will be appreciated. Thanks in advance.
Posted
Comments
Sergey Alexandrovich Kryukov 11-Jun-12 21:21pm    
The language, platform? Please tag it.
--SA

1 solution

I got it

Right("0000"&{MyFieldToPad},8)

Works perfectly as I want it to.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900