Hello, I am fairly new to Python and just started working with ArcPro. I have a solution for my problem working in an excel formula but would like to know how to get this to work in Code Block of Pro.
I have 2 fields; Location and Section. My excel formula is this:
A2 is location and B2 is Section. So if the 1st 3 characters of the location = RMS then nothing else replace the first character with Section
The data looks like this
|B - 18 - F - 1 - N.5||A||A - 18 - F - 1 - N.5|
|RMS - 18 - F - 1 - N.6||RMS|
I have been searching all over but just can't seem to figure it out.
Solved! Go to Solution.
def replace_(fld, val): """Replace a value if found""" if fld[:3] == val: return val else: return fld[:3]
code block is above
However... you really don't say what you want to do it the Location field isn't really RMS ???
Ideally I would like to update the location field and not create a new field. So if location starts with RMS then do nothing but if the 1st character in Location does not equal Section then update the 1st character in location to change to Section value. Hopefully that makes sense. Thank you!