Hello.
I am a researcher ISPRA (Institute of the Ministry of Environment has several hundred licenses for ArcGIS) and I need urgent help to create a procedure in VBA or Python.
The problem is as follows.
I have a shape file with the following numeric fields:
A = decimal number ranging from - 10 to + 10
B = decimal number ranging from - 10 to + 10
C = decimal number ranging from - 10 to + 10
D = average of A, B and C
Category = (initially all 0, and be filled with the result of the script).
I need a procedure based on the specific values ??????of the fields A, B, C and D for that record or object attribute to the Category field value.
The conditions for the same record or object are as follows:
- If both values ??????of A, B and C are <0 then assign at the Category field the value 1.
- In case at least one of the values ??????of A, B and C is> 0 and the value of D is <0, then it will assign at the Category field the value 2.
- If both the value of D is> 0, then it will assign at the Category field the value 1.
How I could implement this procedure? With a script in VBA or Python?
In this regard, the script should be written in the Field Calculator of the field "Category" ?
I tried to write the following script in Field Calculator but it get error:
if! M_IND! <0 and! PAH_IND! <0 and! HOC_IND! <0:
return 1
elif! M_IND! <0 or! PAH_IND! <0 or! HOC_IND! <0:
return 2
else:
return 3
Give me a hand?
Thank you and Merry Christmas.