Zero-fill Field in CR2008

Printed From: Crystal Reports Book — Forum Name: Technical Questions

Hello all!  I am trying to zero-fill a field and am not having much luck.  Basically, I have a check number field that is 5 to 8 characters long and it need to zero-fill to 10 characters (i.e. 12345 needs to be 0000012345).  I have tried doing ToText(<field>, "000000000"), but I get an error saying too many arguments.  Any suggestions you might have would be greatly appreciated!  Thanks!
I am having the same issue.  I need to have 11 total digits regardless of the amount of the check.  So if it is $12 it should read as 00000001200.  Any help with this problem is greatly appreciated.
Pittla-
assuming it is a numeric field:
Right(("00000" + totext({table.field},0,"")),10)
 
Axelcore-
What if it is $12.13? Would it be "00000001213"? or will it always be 00 on the end?
Yes if it is $12.13 it would be 00000001213

Thanks DBlank!  That did work after I converted the field to numeric.  The field was not originally numeric which is probably why my ToText formula was bombing.  Thanks again for your help!

Hi axelcore!  I actually needed the check amount too and I was able to get the formula DBlank gave me above to work by creating another formula field.  This probably isn't the best way, but it worked!
 
create @chkamt field (check amount * 100) then plug in the @chkamt field to another field, say @formatchkamt
Right(("00000" + totext({@chkamt},0,"")),12)
 
Hope this helps!

axelcore , just in case here is how i would do pittla's suggestion for your circumstances:

Right(("0000000000" + totext(({table.amount}*100),0,"")),11)
LOL ya that works much better.  I don't know why I keep doing things the hard way. Wink
SmileSmileSmile  This worked great thanks for the help from both of you.  Much appreciated!!!!!