Saturday 19 November 2016

arcgis desktop - Field Calculator VB Script Codeblock IF statement syntax is wrong?



I can't figure out why the syntax is wrong in Field Calculator ArcMap 10. The complete codeblock is


Dim CapitalDia As Number
Dim TwagDia As Number
Dim X As Number

CapitalDia = [New_Pipe_S]
TwagDia = [DIAMETER_1]

If CapitalDia= 0 Then
X = TwagDia

Else
X = CapitalDia
End If

And then, the bottom window is


Final_Dia = 
X

Answer



The "as Number" is what's causing the error. Just use "dim X"


dim X


if [New_Pipe_S] = 0 then
X = [DIAMETER_1]
else
X = [New_Pipe_S]
end if

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...