I am trying to populate a field with a sorting code that represents the value of another field. Example:
EXPCODE|SORT|
S4DNN2 |3.5
H2BNN2 5.0
EXPCODE is a field with a value like "S4DNN2." SORT is a field that needs to represent the EXPCODE with a numerical value. What would I use for Python code to automatically populate the SORT field? I started with a simple "if" statement, but can't quite figure it out.
def EXPCODE(field_value):
if field_value = "S4DNN2"
return field_value "3.5"
if field_value = "H2BNN2"
return field_value "5.0"
The EXPCODE values I show are examples, I have about 67 different ones with unique numerical values that need to be populated in "SORT"
Any ideas?
Update: I am trying to execute this with the field calculator with use of the python parser