0. I want to turn those "0" values, into "0.0001". I have added a new field: "Lung_lunca", and I want to u…" /> 0. I want to turn those "0" values, into "0.0001". I have added a new field: "Lung_lunca", and I want to u…" />
More

If statement problem in Field Calculator - Arcgis

If statement problem in Field Calculator - Arcgis


I have a field entitled "Lung_lunc". It contains some "0" values and the rest are values > 0. I want to turn those "0" values, into "0.0001". I have added a new field: "Lung_lunca", and I want to use a IF statement in Field calculator, to do so. I have tried the version in the image, but when I run the script, nothing changes (the values remain the same, as in the previous field). I have looked over similar questions here, but did not manage to find a solution.

How should I modify the script, in order to work?

P.S. I have made sure that both "Lung_lunc" and "Lung_lunca" are double fields, so they accept decimals.


I'm not really familiar with VB, but you could use this Python code:

def check(value): if value == 0: results = 0.0001 else: results = value return results

And for the Expression put:

check(!Lung_lunc!)

Make sure to change the Expression Type to Python.


Watch the video: Basic Field Calculator