Model Builder: Problem Populating Attribute Fields in Tool

3234
6
11-19-2013 06:04 AM
JamariPowers
New Contributor III
I am still new to Model Builder but have learned some of the basics. I have been trying to add attribute fields and populate them. I am working with an exisitng tool (Strip Map Index Features; under Cartography Tools in ArcMap). Upon running the tool, there are several attributes that are generated and populated in the attributes table. I have successfully added four fields to the attribute table, however they are not being populated. They are populated as 0's. This is where my lack of understanding is causing me problems.

The four fields I've added:
SMAP_NAME
SMAP_NUM
SMAP_SCALE
SMAP_ANGLE

The Strip Map Index Features tool already generates some of these attributes in the table (Angle, PageNumber), so in the simplest of cases, it would just be a matter of assigning those same values to the attribute fields that I've created (i.e., SMAP_ANGLE would get the values in Angle and SMAP_NUM would get the values in PageNumber).THe next case would be that SMAP_SCALE and SMAP_NAME would be populated from the inpute values.

So overall, there are no major complicated calculations for these attribute fields to be populated. I'm just not sure how to populate these fields that I've created. Again, they appear in the attribute table but with 0's.

Any help on this matter would be greatly appreciated. If I could just get a better understanding of how to calculate one, then I'm pretty sure I could figure out the rest. I have attached screen shots below. Thanks in advance.

P.S.
THe tools that I used to add the fields are 'Add Field' tools under Data Management Tools -> Fields


[ATTACH=CONFIG]29202[/ATTACH] [ATTACH=CONFIG]29203[/ATTACH]
0 Kudos
6 Replies
by Anonymous User
Not applicable
Original User: curtvprice

I am still new to Model Builder but have learned some of the basics. I have been trying to add attribute fields and populate them. I am working with an exisitng tool (Strip Map Index Features; under Cartography Tools in ArcMap). Upon running the tool, there are several attributes that are generated and populated in the attributes table. I have successfully added four fields to the attribute table, however they are not being populated. They are populated as 0's.


Now that you've added the fields, you can populate them using the Calculate Field tool.
0 Kudos
JamariPowers
New Contributor III
I have been reading up on the 'Calculate Tool' button but am still having trouble. I've added it into my model, but as far as setting it up, again, my lack of knowledge on what to put in the fields, what becomes the input value, and how to set the calculations is haulting my progress.
0 Kudos
by Anonymous User
Not applicable
Original User: todd93

For running Calculate Field you need to specify three inputs:

Input table - this is the table that has the field you'd like to calculate

Field name - this is the field that you'd like to calculate

Expression - this is where you will tell the tool what you'd like to calculate. If you click on the calculator icon, this will open up the "Field Calculator". The name of the calculate field is shown below below where it says "Show Codeblock". What you enter into this text box depends on what you'd like to calculate.

For example, if you have a field with distance values in units of feet named "dist_feet" and you'd like to convert these values to meters in a new field called "dist_meter" then you would type [dist_feet] * 0.3048 into the text box.

You can also double-click on the field names to add them to the text box for building your expression.
0 Kudos
JamariPowers
New Contributor III
I see. When I select the input for my 'Calculate Field', there are no options to select from in the 'Field Name' list. Is this list supposed to be populated or can you type in any field name for it to work?
0 Kudos
by Anonymous User
Not applicable
Original User: todd93

You need to have a table included as the "Input Table". Then, the drop-down menu associated with "Field Name" will be populated with the fields of the Input Table.
0 Kudos
JamariPowers
New Contributor III
I think I have figured somehting out. It seems I'm making this harder than it is. I used the 'Output'  as my input table, set the Field Name to 'SMAP_NAME', and made the expression to "%Map Name%" (In reference to my model above).

When the tool is ran, the user actually fills in the map name. The attribute SMAP_NAME is now populated. Not sure how or why this all of a sudden works now, other than me making it harder than what it seems and your advice. Thanks for your help / Todd93
0 Kudos