Convert a field name into a variable to substitue in feature selection and field calc

Discussion created by mfrancis_CoServ on Sep 14, 2012
Hey All,

In Model Builder, I am updating point attributes after a spatial join to a polygon layer.  Both input feature classes are paramaters, so after the spatial join, a new temporary feature class is created.  I then do a tabular join from the point table back to the temporary join table based on the object_id, so that I can now update several fields in the point data that may be incorrect.

I would like to be able to create a table view where Trans.TRANS.ROAD.ZONE <> TRANS_SpatialJoin1.ZONE_1, and then calculate Trans.TRANS.ROAD.ZONE = TRANS_SpatialJoin1.ZONE_1 

My problem is the next time I run the model, the field names are different:  Comm.COMM.ROAD.ZONE and TRANS_SpatialJoin1.ZONE_1  So, my table selection and subsequent field calculation functions are dependant on strict field names and are both broken internally in the model.

How can I make a variable, %zone% for a field name that can be used to both create a table view AND can also be used in field calculation? 

Many thanks!