Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a shapefile with data of fish specimens and the coordinates where they were tagged for research purposes. One of the fields in the attribute table of these shapefiles is the fish length in centimeters (ReLenCM). I am building a model that will create three new fields in the shapefile with weight values calculated with three different estimations of the length-weight relationship for that species. To make my enquire simpler, instead of using those functions yet I´m trying to just have the length value multiplied by an iteration. My For iterator is From 2, to 4, by 1. Meaning my three iterations are 2, 3 and 4. Therefore, for instance for the first row in the table (see pic) I am aiming to have something like this:

ReLenCM = 79; W_2 = 158; W_3 = 237; W_4 = 316

This is the configuration of the ArcGIS 10.1 for Desktop model:

ADD FIELD:

  • Field Name_Add = W_%value% (resulting in W_2, W_3 and W_4)
  • Field type = Double
  • Input table = Model parameter (shp of tagged fish releases)

CALCULATE FIELD

  • FieldName = %Field Name_Add% (not entirely sure about this one)
  • Expression = Here is where I want to multiply length by each of the iterations. You can see my attempt in the picture ([ReLenCM] * [W_%value%]), but with that expression all I get are "0" values...

Basically, I just need to know how to insert the %value% variable from the iterator in the SQL expression. I have found some posts describing a similar issue, but always with String variables, not numeric.

Model diagram

share|improve this question

1 Answer 1

I am thinking that you are getting "zero" values because your expression is multiplying the length field by the newly created, and ultimately blank (Null), W_%value% field. I think your expression needs to be:

( !ReLenCM! * %value%)

This way you are actually multiplying by your iterator value and not a blank field. Also, use "Python" as your Expression Type in the Calculate Field tool. Finally, make sure the "Field Name" parameter in your Calculate Field tool is the new one you just added (W_%value%).

Example Model

Full size model image

Result Attribute Table

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.