Good Morning All,
This is more of an archiving of knowledge and perhaps a help to others but I would certainly like comments if there is a better or way to do what I needed.
I recently needed to pull the remaining characters out of a variable length text attribute after a certain starting point. The Calculate Field Python examples was a great starting point with its !SUB_REGION![-3:] for the right most characters but did not fit my situation where the starting attribute contains variable length records.
I needed to grab the remaining characters after character 5. For our Assessor system positions 1-3 = Book, 4-5 = Page, 6-8 or 9 = Parcel depending on if there is an alpha character or not.
APN Sample data:
What I came up with on the Calculate Field is Parcel = !APN![0-len(!APN!)+5:] This calculates the remaining characters by attribute. By starting with 0 and subtracting the length of the attribute then adding in how many characters to ignore, the remaining characters are copied to the Parcel attribute.
This is what worked for me. In programming there are always alternative methods so please feel free to share.
Solved! Go to Solution.