how to add leading zero to a text field in crystal reports

Viewed 19755

I'm trying to think of a way to add a leading zero to a string field value. For example I have 12345 but need a formula that would convert it to 012345. I'm new to Crystal as I know that this is probably a simple formula but cant seem to get it to work.

12345 => 012345  (add leading zero to make it 6 chars)

Thanks in advance.

7 Answers

how to use the formula in your crystal report, to put below mention formula in ( open (field explorer)-->then right click(Formula field)-->select new--->create formula name(xyz)-->then put ** ToText({DataTable1.Sr_No},"0000") **

copy/past only bold text between ** and then save and close

after that formula you add to your crystal report and run, your required answer is there,

Sr_No. 0001 0002 0003

Related