1
votes

I'm trying to add leading zeros to 'Record Number' special field provided by Crystal Reports 13.

Eg:

  • Record Number 1 should be '001'
  • Record Number 20 should be '020'

I have noticed that there's a related post about customizing table fields by using ToText({table.field},"000"). But this approach doesn't work when I use {recordnumber} instead of {table.field}.

1
@MatSnow edited the main question according to my problam.Praveena Goonasekera
@PraveenaGoonasekera you are not going to use {recordnumber} just use recordnumber. { } are just for fields, see my answer. Just tested here and it's working pretty fine.jhenrique

1 Answers

0
votes

Create a new formula to your desired field, then add this:

Right(("000" + ToText(({Comand.YourField}), 0, "")), 3)

That's it (note that if you need more zeros you can edit the formula. For 10 digits it will be Right(("0000000000" + ToText(({Comand.YourField}), 0, "")), 10) and so on.

As you completed your question, if you want RecordNumber use this way:

Right(("000" + ToText((RecordNumber), 0, "")), 3)