1

I'm an admittedly novice when it comes to scripting but I have been able to create a basic 'else if' with 'OR' expression to create a label for a fuse feature class I have constructed. I am now trying to combine an additional field into this statement but have been at a lose on how to get there.

In the code shown below I am labeling fuses by assigning a number (1, 2,3) based on its phasing code (A, AB, ABC); respectively. I now also want to assign an "I"(installed) or a "P"(proposed), preferably in bold, that corresponds with my "Construction Status" field.

Function FindLabel ( [phasingcode] )
Dim a
If [phasingcode] = "A" OR [phasingcode] = "B"  OR  [phasingcode] = "C" then
    a = "(1)"
Elseif [phasingcode] = "AB" OR [phasingcode] = "BA" OR  [phasingcode] = "AC" OR [phasingcode] = "CA" OR [phasingcode] = "BC" OR  [phasingcode] = "CB" then
  a = "(2)"
Else
 a = "(3)"
end if 
FindLabel = a
End Function

1 Answer 1

1

You just have to add the "Construction Status" field in the Function FindLabel then create a "b" variable that you fill using the same logic you used for your "a" variable and change the FindLabel = a to FindLabel = a&b

See below for what it could look like (sorry, no time to write it properly...)

Function FindLabel ( [phasingcode],[Construction Status] )
Dim a
Dim b

If [phasingcode] = "A" OR [phasingcode] = "B"  OR  [phasingcode] = "C" then
  a = "(1)"
Elseif [phasingcode] = "AB" OR [phasingcode] = "BA" OR  [phasingcode] = "AC" OR [phasingcode] = "CA" OR [phasingcode] = "BC" OR  [phasingcode] = "CB" then
  a = "(2)"
Else
  a = "(3)"
end if

If [Construction Status] = ... then
  b = ...
Elseif [Construction Status] = ... then
  b = ...
Else
  b = ...
end if

FindLabel = a&b
End Function

For the bold part you could try FindLabel = a & "<BOL>" & b & "</BOL>" but I didn't try that...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.