In some cases, you may want to calculate a field based on the value of another field. A good example of this would be when you may want to create or calculate domain code values from a description field.
In the following example we are using some Tree data to calculate the Risk_Code associated with the Risk description which can then later be used as a Domain.
- To begin, open the Attribute Table for the data in ArcGIS Pro
- Select applicable field to calculate (i.e. RISK_CODE)
- Right click field (RISK_CODE) > Field Calculator
- Select Python 3 as the Expression Type
def calcRiskCode(riskDesc): if riskDesc == "High": return 1 elif riskDesc == "Medium": return 2 elif riskDesc == "Low": return 3 else: return 0
- Click OK.
Further Calculate Field Examples: