Quantcast
Channel: Forums - ArcGIS for Desktop - General
Viewing all articles
Browse latest Browse all 2328

Having Trouble writing VB Script to label features

$
0
0
I'm updating labels on an existing map that some else created. The person who originally created this mxd used a VBScrpit to label the pipes but did not follow through with it to label the pipe properly. What needs to happen is the sewer pipes need to be labeled with the diameter if greater than zero AND non-round pipes need to be labeled with both sizes, for example, round 12” or non-round, 12”x12”.

The fields needed are [TYPE] – string and [SIZE_] (diameter) and [SIZE2] which are both double; Nulls are not allowed for all three attributes.

Both of the following statements work, as they should, by themselves but I am unable to get them to work together. Granted they work as they should when the Advanced box is checked in the Label Expression window but I’ve tried it without it being checked. I’ve also tried various If/Then, If/Then/Else statements also.

Function FindLabel ( [SIZE_], [TYPE] )
if ( [TYPE] = "existing" and [SIZE_] <> 0) then
FindLabel = [SIZE_] & "''"
end if
End Function

Function FindLabel ( [SIZE_], [TYPE], [SIZE2] )
if ( [TYPE] = "existing" and [SIZE_] <> 0 and [SIZE2] <> 0) then
FindLabel = [SIZE_]&"''"&"x"&[SIZE2]&"''"
end if
End Function

What should the statement look like to work? I should also note I know enough VB to do VERY basic things.

Viewing all articles
Browse latest Browse all 2328

Trending Articles