I try to calculate some fields with the field calculator using a simple if-else condition. I would like to write the values in the field volume, based on some calculations including values of fields
shape_area (no coordinates).
The code works, when I use just one integer/no math functions. If I try it like it should be, I get syntax error .
import math def muh(bedingung, wert, Shape_Area): if (bedingung == "hallo"): value = (4.3 * math.log(!wert!)) * !Shape_Area! elif (bedingung == "echo"): value = (2.7 * math.log(!wert!) * !Shape_Area! return value
volume = "muh(!bedingung!, !wert!, !Shape_Area!)
I can't seem to find the fault. The problem lies between numeric values and "string" (?), I guess, I have to escape or convert some parts of the code?