I have a field (WS_Type in the screenshot) that I want to use to calculate values based on the text within the field. The number of occurrences of each WS_Type in the field is not important, but the presence of each different type in the field is. Basically, I need to create an if/then statement that says, if this field contains "NRW" AND "Diversion", then it will get a score of X. If this field contains "NRW" OR "Spring" it will get a score of Y, etc. I'm not sure how to set up this if/then statement.
[GIS] Field calculator to calculate if field contains certain text
arcgis-10.5arcgis-desktopfield-calculatorif elsepython-parser
Best Answer
Create a new field for your output. Make sure it is string type.
Click Show Codeblock.
Write your code block/'Pre-Log Script Code' in python like this:
Then use it on the field you created like this:
new field=