I'm trying to calculate a total demand in ArcGIS 10.2.2, stored in fields Demand1, Demand2, ... , Demand20. Some of them contain a numeric value. The others have a
<Null> value. The sum therefore always returns
I've tried in Python to define, in the pre-script a function:
def D(a): 0 if a else 1
(as recommended in Field calculator if and elseif statement with <Null> values in ArcGis 10.1, with correct indents, etc.)
then in the code
D( !Demand1! ) + D( !Demand2! ) + ... + D( !Demand3! )
It cannot compute. Do you have any suggestions?