bdbacca

Field Calculator Woes

Discussion created by bdbacca on Feb 26, 2011
Latest reply on Feb 28, 2011 by bdbacca
Alright, I'm trying to model a watershed district for surface flow and I'm up to the CN grid. I have most of it completed, merged my land use polygons with the soil type and ranked the soils A-D but now I'm trying to calculated the soil type for each polygon and the field calc has me thrown for a loop.

I have columns of "polygon_area", "Hydgroup", "PctA", "PctB",.."PctD" . I have 1684 rows and REALLY don't want to do this the brute-force method so I opened up the field calc and typed in:

if [Hydrgrp] = "A"
  [PctA] = 100
endif

My hope is that it will scan the column, find the true statements, then fill in the column with the value of 100. If the row says "B" (or c/d), the statement would be false and either be left blank or filled with 0. (I know how to use the ELSEIF function a la Matlab also)

My question is if I throw the above into the Pre-Logic VBA Script code box, there is still a box below with the leading "PctA = " and I can't run the calculator without something in that field. If I put my IF statement in there, I get the "Error running VBA code: User interrupt" message. If I put an integer value in this lower box, it fills my entire column with that value without my IF filter.

What's the deal?!
ArcGIS 9.3 with GeoHMS toolbars installed on a Windows 7 PC.

Also, I tried to setup the IF statement where it would use:
[hydgrp]/"A"= aValue
  aValue=1  in the VBA box then in the lower box, PctA= aValue*100 but that gave the same error as above.

I don't understand how to run the calc with a VBA script then the equation bar. :-/

I'd appreciate any help/guidance!

Outcomes