Solved! Go to Solution.
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?
If IsNull([UpstreamElev]) Then Output = [InvertElev] Else Output = [UpstreamElev] End If
This requires that you check the box to allow for a codeblock located just above the expression text box. This will create two entry textboxes, with the top one being for code and the bottom one being the output to the field. I would do it this way in VB Script (Python can also do it but I am a VB guy)
Parser: VB Script
Use Codeblock: checked
Pre-Logic Codeblock:[ATTACH=CONFIG]30393[/ATTACH]
Expression: Output
For the bracketed field names in the Pre-Logic Codeblock replace them with whatever the field list inserts to handle the join qualification of the field names. You have to output a value for every record, so the only way to prevent an error or a change to an existing value is to overwrite the existing value with itself.
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?