I have a NAME field for multiple assets: Tanks, Reservoirs, Pump Stations, etc. Currently, I have everything labeled using the following script:

[NAME] & vbNewLine & [Vol_Mgal] + " " + "Mgal"

I would like to include the elevation for just those that contain the word Tank. Is there a way to do this using script?

Here is my latest attempt:

Function FindLabel ([NAME], [ADDRESS])    
  if (cLng([ADDRESS]) = "TANK" then
    FindLabel = [NAME] & vbNewLine & [Vol_Mgal] + " " + "Mgal" + "," & [ELEVATION]+"ft"
     FindLabel = [NAME] & vbNewLine & [Vol_Mgal] + " " + "Mgal"
 end if
End Function

Results: "Carriage returns are not allowed in simple expressions."

  • Is Elevation an attribute of your data, if not you will need to bring it into your dataset. Also good practise to include screen shots of your data as my first question would be elevation of what, donuts on Mars? You also neglect to say what software you are using? State that and add the tag.
    – Hornbydd
    Jan 9 at 15:55
  • Elevation is an attribute of my data.
    – CatchE
    Jan 9 at 15:57
  • This line is nonsense - if (cLng([ADDRESS]) = "TANK" then. You are converting address to a number and trying to compare a number to the text "TANK".
    – Hornbydd
    Jan 9 at 16:34


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.

Browse other questions tagged or ask your own question.