Skip to main content

Adding Leading Zeros

Good afternoon,
I am trying to add leading zeros to a character field and want all values in the field to have a character length of 9.  For example, I would like 1234B11 to be 001234B11.  Is there any easy way to do this within the Equation Editor window?
 
Thanks!

klmi Wed, 11/13/2019 - 03:02

In reply to by klmi

If you have IDEA 10.3 and above also Python could help you:

1) Make a new script fill.py and save it in the library as user defined function.


def fill(param):
return param.zfill(9)

2) append a new char field with the following equation:

@python("fill"; FIELD)

Gugge Wed, 11/13/2019 - 09:20

Hi Breanna,
@Right( @Repeat( "0" ; 9 ) + @Alltrim(FIELD) ; 9 )
will also solve Your problem.