I'm a programmer, I have programmed in C#, Java, but not with Python. And I'm not a geographic worker. How can I write a python script into Field Calculator to be able to check the other column value. If that other column value is "a certain string", the value in this column should be 0, otherwise it should be computed with an equation. The value I want to look is a Text type, and I want to count in a Double type column.
|
You don't 'Dim' variables in python, you just declare and assign them. That said, your basic route is to set the parser to python and check Show Codeblock. In the Pre-Logic Script Code box, enter your function like this:
In your 'field =' box, enter:
In python , # means a comment. Indentation counts. If your calculation depends on other fields, pass those in as well. That should be straightforward with your background. In calling the function, the field name is bracketed by quotation marks. |
|||||||||||||||||
|
I'm a long time ArcGIS user but find that the QGIS field calculator is a lot more intuitive & provides options for dragging & dropping fieldnames, expressions & operators. If you are a programmer, then you'll probably find it a lot easier and you'll find it builds your knowledge for using the expression builder in ArcGIS.
|
|||||||||||||
|