AnsweredAssumed Answered

Using Select Layer by Attributes and Calculate Field together in Model Builder

Question asked by Tomdark on Oct 9, 2013
Latest reply on Oct 10, 2013 by rfairhur24

I'm making a model in Model Builder inside ArcGIS for Desktop 10 and running into the following problem:

I have a feature class that I want to select a portion of based on the entry in a specific field and then modify a different field in the same feature class for just the rows that were selected using Calculate Field.  I've made a model that uses the "Select Layer By Attributes" to select the rows I wish to modify, and implemented the "Calculate Field" tool immediately after the "Select Layer By Attributes" tool to modify another field within the feature class.

My problem is the "Calculate Field" tool modifies every row in the attribute table for the feature class instead of just the rows that were selected in the "Select Layer by Attribute" tool.  How can I make the "Calculate Field" tool work on just the selections from the preceding tool?

I have been trying to learn VB If-Then statements and Select-Case statements to try to eliminate the "Select Layer by Attributes" portion of the model and simply do it all in the "Calculate Field" tool but my VB skills are basic at best and every time I try I get an error saying "No records within table". 

I am using VB code in the "Code Block" window that is the following:

If [DDP_OID.Tim_Permission] = "Yes"

and in the "Expression" portion of the Calculate Field tool I have:

Int ( 2 )

Any help would be absolutely wonderful.

Thanks in advance,