basile_chaix

Calculate field based on a condition

Discussion created by basile_chaix on Sep 24, 2011
Latest reply on Sep 26, 2011 by dkwiens
Dear colleagues,
In a Python script, I would like to attribute a value to a specific field name Frequency, conditional on another field:
Basically this is what I want to do:
If Id = "Q5" then Frequency = 7.
In this Python script, I believe I should use:
gp.CalculateField_management("E:/Shapes.shp", "Frequency", expression, "PYTHON")

I don't know how to write the expression to do what I have described above. Could someone help me?

Best wishes,
Basile

Outcomes