Calculate Field based on Criteria

890
3
11-02-2016 07:32 AM
ModernElectric
Occasional Contributor III

I have a polygon feature class within a file geodatabase that contains parcel information for our utility district. I am working on building some models to update the parcel data from raw data. One of the areas that I am stuck on is with using the Calculate Field tool. One of the fields has (2) attributes (Proxy and Condo). What I am trying to do is to select all rows that have an attribute of "Condo" and copy the PID (Parcel Number) into a new field. Also, to enter the attribute "Condo" into a new field as well. Not sure how to select the PIDs that have the 'Condo' attribute and copy only those records into a new field.

Thank You for the help

0 Kudos
3 Replies
DanPatterson_Retired
MVP Esteemed Contributor

Note sure what you have... an example of the table would help.

Why not do a select by attributes for the condition you want, then activate the field that you want to update and simply type in the value you need given that attribute... there is no need for a fancy field calculator expression

ModernElectric
Occasional Contributor III

What I am trying to figure out is by doing this in Model Builder: I want to be able to write an expression with the Calculate Field tool in a model to say if the attribute in the PARCEL_TYPE field is Condo, then copy the related attribute in the PID_1 Field into the PID_NEW field. In the past, I would do this manually. Now, I am building a model to do this automatically.

Thank You 

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

same approach, a select by attributes, then a field calculate.  Selected records are acted upon and the others are not changed.  so query  parcel_type_new==Proxy, then field calculate  PID_NEW= PID_1

I would use python, just make sure your field names are enclosed in ! !.

set up your query and then calculate.

See the examples here Select Layer By Attribute—Help | ArcGIS for Desktop  and Calculate Field—Help | ArcGIS for Desktop 

I presume it is the same in modelbuilder since you are just dragging the tools onto the model and setting up their parameters.

0 Kudos