I have what should be a fairly straightforward operation failing in ArcGIS Pro 2.4, and cannot for the life of me work out why.
If the field "assettype" contains a portion of the search string, then set the value of assettype_groupup to the value I return.
Eg, if "assetttype" contains the string "Building |Residential |Large ", and I test whether it contains the term "Residential", and that evaluates to true, then return the string "Residential".
Currently the code does not seem to be returning any result / has no effect, and appears to run too quickly (2-3 seconds for 3,000,000 lines).
If I try a ternary statement, which means using a single term at a time, it seems to work just fine.
Can you see any obvious issues with the setup below
#Expression
func(!assettype!)
# Code block
def func(input😞
if 'Residential' in input:
return 'Residential'
elif 'Industrial/Utilities' in input:
return 'Industrial/Utilities'
elif 'Transport/Infrastructure' in input:
return 'Transport/Infrastructure'
elif 'Conservation/National Park' in input:
return 'Conservation/National Park'
elif 'Recreational/Open Space' in input:
return 'Recreational/Open Space'
elif 'Mixed Use' in input:
return 'Mixed Use'
elif 'Community Use' in input:
return 'Community Use'
elif 'Rural/Primary Production' in input:
return 'Rural/Primary Production'
elif 'Special Use' in input:
return 'Special Use'
elif 'Unknown' in input:
return 'Unknown'
else:
''
Looks like: