Field Calculator based on another field in Table

1937
13
Jump to solution
01-10-2014 05:29 AM
Highlighted
New Contributor II
Howdy,

I have joined a sewer Gravity Main (pipes) table to my Manholes table based on [From_Manhole]. My next step was using the field calculator set the values of [Upstream_Elevation] in my Gravity Mains table equal to the values of [Invert_Elevation] from the joined Manholes table. However, when I try to execute this function, I get an error message. Am I using the right expression? The input field and destination fields are both Double with a precision of 38... not sure if this matters?

Here is what the geoprocessing results showed me:

infrastructure.PUBLICWORKS.ssGravityMain.Upstream_Elev= [infrastructure.PUBLICWORKS.ssManhole.INVERTELEV]

General Error executing calculator
ERROR 9999999
Syntax error
Failed to execute
Tags (2)
Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
MVP Honored Contributor
Sorry, my lacking scripting/syntax knowledge is what holds me back here. Here is what I am putting in as directed, yet the values are not calculated. Did I enter the right field in the output?


The second text box is wrong.  It should just have the word Output in it.  Output is a variable name and the calculation will substitute that name with the appropriate value determined by the codeblock logic.

By putting the calculated field name into the output textbox the codeblock logic was totally ignored and instead every value already in the field just overwrote itself with the same value that it already had.

View solution in original post

Reply
0 Kudos
13 Replies
Highlighted
MVP Honored Contributor
Howdy,

I have joined a sewer Gravity Main (pipes) table to my Manholes table based on [From_Manhole]. My next step was using the field calculator set the values of [Upstream_Elevation] in my Gravity Mains table equal to the values of [Invert_Elevation] from the joined Manholes table. However, when I try to execute this function, I get an error message. Am I using the right expression? The input field and destination fields are both Double with a precision of 38... not sure if this matters?

Here is what the geoprocessing results showed me:

infrastructure.PUBLICWORKS.ssGravityMain.Upstream_Elev= [infrastructure.PUBLICWORKS.ssManhole.INVERTELEV]

General Error executing calculator
ERROR 9999999
Syntax error
Failed to execute


All you should need is the input field in the brackets in the expression of the Field Calculator chosen from the field name list. I.e.

[infrastructure.PUBLICWORKS.ssManhole.INVERTELEV]

You don't put the target field in the calculation expression, you just right click the field you want the calculation to update to initiate a Field Calculation on it.
Reply
0 Kudos
Highlighted
New Contributor II
Yes, sorry if I didnt make that clear. I did right click UpstreamElevation field and selected = [infrastructure.PUBLICWORKS.ssManhole.INVERTELEV] as the input
Reply
0 Kudos
Highlighted
Esteemed Contributor
What version of ArcGIS are you using?

Are you performing this operation in the Field Calculator tool of ArcMap?

Is the Scale property for both double precision fields also the same?
Reply
0 Kudos
Highlighted
New Contributor II
yes, I am doing this all in Field Calculator, I right clicked the field I want to calculate, selected and equals symbol, and double clicked the Invert Elevation field from the joined table, that's it. I am using 10.1 and it is an ArcSDE database.
Reply
0 Kudos
Highlighted
New Contributor II
the precision and scale are both the same

Precision is 38
Scale is 8
Reply
0 Kudos
Highlighted
New Contributor II
I got it, ha! I must do not need the equals symbol in the expression

syntax, syntax, syntax.... doh!
Reply
0 Kudos
Highlighted
Esteemed Contributor
Do you need to perform this type of operation when new sewer information is provided to you (collected)?  If so, you might want to consider making a model and exporting it to python.
Reply
0 Kudos
Highlighted
New Contributor II
Is there a way to write an If then statement in the Field Calculator?
ie. If the UpstreamElevation is <Null> then UpstreamElev=InvertElev

This way I dont overwrite values in the Upstream Elevation field that are already in there?
Reply
0 Kudos
Highlighted
MVP Honored Contributor
Do not use an equal sign in the calculation expression.  That is assumed and only applies if you wanted a True/False result from the calculation (requiring both side of the = expression to have values).  You don't want that.  All that should be in the expression is the bracketed field name inserted by the field list.
Reply
0 Kudos