jnemecekOCGIS

'If...Then' Code for Field Calculator

Discussion created by jnemecekOCGIS on Nov 14, 2011
Latest reply on Apr 24, 2012 by mdenil
I completed a Model that overlays several polygon layers, clips out a specified section, dissolves according to certain attributes and sums the acreage.  What I want to do is add another Calculate Field entry into my Model, but I can't get the Field Calculation correct.  The Fields I want to select from are [CAUVLCType] and [MUSYM].  The fields are coded-value domains and descriptions.  What I've tried is similar to Label expressions:

Function
if ([CAUVLCType] = 'CROP' AND [MUSYM] = 'NpA') then
[Soil_Acreage] * 460
elseif ([CAUVLCType] = 'WOOD' AND [MUSYM] = 'NpA') then
[Soil_Acreage] * 100
End if
End Function

Can someone provide me a couple lines of code that will work on a copy/paste basis which I can repeat and enter different field descriptions as needed?!

Thanks, Jeff

Outcomes