I am new in the VBScript world, so I am really confused with programming. I need to do this expression in my evaluator in my Network Analyst. Basically I am adding a "cost" that is my percentage of primary roads, where:
TIPO 0 = Primary roads TIPO 1 = Secondary Roads TIPO 2 = Tertiary roads
So the equation should be really simple: Primary Roads/(Total Roads)
In that Way, I made this Field Evaluator
The value is: C
My script is:
Dim A If [TIPO] = 0 Then A = [SHAPE_Length] elseif [TIPO] = 1 Then A = [SHAPE_Length] elseif [TIPO] = 2 Then A = [SHAPE_Length] end if Dim B If [TIPO] = 0 Then B = [SHAPE_Length] elseif [TIPO] = 1 Then B = 0 elseif [TIPO] = 2 Then B = 0 end if Dim C C = A / B return
The value is: C What happens is that even that the field Evaluator shows has okay(without errors), the when calculating the field, it shows 0 has an answer, and sometimes show an error messagem when I try to rebuild my network.