MavKat

Model Builder - Select, Select by Attribute, Calculate Field, and Coded Domains

Discussion created by MavKat on Jun 10, 2014
Latest reply on Jun 10, 2014 by mdenil
Two issues:

1) I'm trying to build a model that will take the table of a feature class and replace certain values in the same feature class. Example:

I have [field] with values (coded domains) of -1, 1, 2, 3, 4, X. Every time the coded domain is -1, I want to replace it with X.

There are ~15 fields that I want to do this with. Currently I am using Select Layer By Attribute, however this seems to mean that I have to have the layer in the .mxd to use the tool, and I would ideally like to run it from catalog. If I switch to using Select then I get a new feature class of my selection which will not work because in the end I need the whole table (or maybe there is a way it will work that I'm just not aware of yet).

Is there another tool to use, or a code block that I can tweak (there has to be...) in the Calculate field tool to select the records I want to change? I'm pretty decent with programming logic, but syntax is another issue entirely.

2) I have a coded domain value of 001, stored as text. I want to create a variable paramater for the model where the input will be exactly 001 and this will be used to calculate the field value. The problem is that every way that I do this the field updates to 1... unless I enclose 001 in double quotes. I was hoping to use the variable for other calculations where the quotes are not neccessary, and it would be best if I didn't need to rely on the user to read instructions about putting this parameter in double quotes (plenty of headaches could be avoided). Any way to do this??

Outcomes