ArcGIS 10.0 ModelBuilder – Calculating Field Using Iterate Feature Selection

arcgis-10.0modelbuilder

I'm trying to streamline a model that identifies all zones that intersect each parcel in our Local Government Area (eg. Parcel x has Zone B1, B2 and E4). I am trying to make use of iterators in ArcGIS10. The problem is in bold italics below;

I have a Zones layer and a Parcels layer. I select all polygons of Zone A (using iterate feature selection) then do a select by location to get parcels that intersect those selected polygons. I now want to check if Field1 is empty, if it is, use calculate field to populate Field1 with the "Zone A" value used to select my zone in the first place. I then continue with some simple if-then-else logic and the model then iterates with Zone B.
Screen Capture of my model
I built a working version of this in ArcGIS 9.3.1 that works but it is extremely cumbersome and making small changes to the process is very time-consuming.

Any suggestions are much appreciated.

P.S. I have no python experience and only a little VB knowledge but if writing an arcpy script is the only solution to my problem then I'm more than happy to start learning!

Best Answer

When you say empty, I assume you mean "Null" or Empty like this: "".

Pass the ZoneName value into the "Calculate Value" model tool. Then write a basic python function in the "code block" section of the calculate value tool. If values are null:

def getField(field) if field is none: return "Zone A"

then call the function in the "expression" section of the Calculate Value tool like this:

getField("%ZoneName%")

Select String for "Data Type"

Now pass that into value into your field calculation as ("%Value%")