I have been racking my brain, but I can't seem to find a solution to appending my field values in my .dbf to correspond with the values of my feature's attribute table. All I need to do is to append 0's to the field value if the field value is less than 11 characters in length. It needs to be done in the field calculator through VB Script or Python.
|
|
You have several options in python: zfill, interpolation operator ('%'), and rjust (pad with any character...not just zeros). See this SO question: http://stackoverflow.com/questions/339007/python-nicest-way-to-pad-zeroes-to-string There's also an example here: http://forums.arcgis.com/threads/35137-Populate-a-field-with-consecutive-numbers-by-a-constant-length-string.?p=119553#post119553 |
|||
|
|
|
Using python's string multiplication, this can be done very simply in a couple of lines. The only tricky bit is that you must convert an int to a string in order to use the Assuming the field you are working with is called
Which can be called with:
|
|||
|
|
|
possibley this could be a one-liner..but i am not able to figure out for now :) Pre-Logic Script Code:
call it using
|
|||
|
|

