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
What is in the tables? (a couple of rows as an example)
If you are using the 'in' operator, then it would suggest that "Residential" may only be part of a potential value, otherwise you could just use the equality check.
I am sure you have ruled out text case as a culprit. And that the output field is indeed text.
As it turns out, my issue was mostly likely related to using a reserved word.
Answer here: python - Locating a substring in Field Calculator using ArcGIS Pro - Stack Overflow
Python has no substring methods like substring() or substr(). Instead, you can use slice syntax to get parts of existing strings. Python slicing is a computationally fast way to methodically access parts of your data. The colons (:) in subscript notation make slice notation - which has the arguments, start, stop and step . It follows this template:
Parameters are enclosed in the square brackets.
Parameters are separated by colon.
string[start: end: step]