Select to view content in your preferred language

Calculate Field problem.

1747
6
Jump to solution
01-12-2017 08:17 AM
Maximiliano_A_Bernal_Giraldo
Deactivated User



Hi everyone, I'm making a model that basically selects the links that must change the value of one field, those links are selected by the proximity to the line feature, there are 108 line features thats why the iterator.

my problem is: the value that I have to put in the field is contained in each of the 108 features lines, with the tool get field I reach the value, but for some reason I don't know Calculate field tool do not recive the variable as a input, (only when the data type is variable or string it recives it, my value is double)

Can you please show me the problem to fix it ?

thanks

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
ChrisDonohue__GISP
MVP Alum

What appears to be needed is a the use of an In-line variable in the Calculate Field tool so you can use the result of the Get Field Value.  You will have to code this manually - it won't be available by pulldown.  So in your Expression in the Get Field Value tool, it would look something like this:

 fieldname = %Vel%

The key is the percentage symbols on either side of the variable.  In the model you posted, the output of the Get Field Value was called Vel, so one can tap its value by using %Vel%.

From the Get Field Value tool help:

The Get Field Value tool gets the first value from a table of the specified field, and the value is then used as an in-line variable in the expression of the Calculate Field tool to find the percentage area of each polygon.

ArcGIS Help (10.2, 10.2.1, and 10.2.2) - Examples of Modelbuilder-only tools

ArcGIS Help (10.2, 10.2.1, and 10.2.2) - A quick tour of Inline Variable Substitution

Chris Donohue, GISP

View solution in original post

0 Kudos
6 Replies
ChrisDonohue__GISP
MVP Alum

My very first thought would be that it is a casting issue.  However, that's just a guess.  Can you post a screenshot of what the Calculate Field Dialog box information is?  I.e. what information was input.  Can you provide a screenshot?

Chris Donohue, GISP

0 Kudos
Maximiliano_A_Bernal_Giraldo
Deactivated User

Maximiliano_A_Bernal_Giraldo
Deactivated User

As you see because I can't make the conection between the output of "get field value" and "Calculate field" I can't assign the value to its corresponding field.

even further I think the main problem is Calculate field tool needs all the the values to fill the field are in the same table, and don't let they come from external sources, but it's just my opinion, perhaps it is a way I don't know.

0 Kudos
ChrisDonohue__GISP
MVP Alum

What appears to be needed is a the use of an In-line variable in the Calculate Field tool so you can use the result of the Get Field Value.  You will have to code this manually - it won't be available by pulldown.  So in your Expression in the Get Field Value tool, it would look something like this:

 fieldname = %Vel%

The key is the percentage symbols on either side of the variable.  In the model you posted, the output of the Get Field Value was called Vel, so one can tap its value by using %Vel%.

From the Get Field Value tool help:

The Get Field Value tool gets the first value from a table of the specified field, and the value is then used as an in-line variable in the expression of the Calculate Field tool to find the percentage area of each polygon.

ArcGIS Help (10.2, 10.2.1, and 10.2.2) - Examples of Modelbuilder-only tools

ArcGIS Help (10.2, 10.2.1, and 10.2.2) - A quick tour of Inline Variable Substitution

Chris Donohue, GISP

0 Kudos
Maximiliano_A_Bernal_Giraldo
Deactivated User

thank's man, it work

0 Kudos
ChrisDonohue__GISP
MVP Alum

Glad to be of help.

Chris Donohue, GISP

0 Kudos