English

How To: Create advanced label expressions using VBScript

Summary

This article contains some syntax examples for creating common advanced label expressions using VBScript. Enter these expressions in the ArcMap Label Expression dialog box.

Procedure

  1. Open the Label Expression dialog box in ArcMap.
    [O-Image] ArcMap Label Expression dialog box
    Note:
     At ArcGIS Desktop versions 8.2 and later, click the Help button on the Label Expression dialog box to display more help on advanced label expressions. 
  2. Use an ampersand (&) to append a text string to the Label Field.
    "Name: " & [Name]
    [O-Image] append text to a label
  3. Use the UCase function to convert the Label Field to upper case.
    UCase([Name])
    [O-Image] Label Expression using Upper Case
  4. Create a multiple-line label using the VbNewLine keyword.
    "Name: " & [Name] & vbNewLine & "Type: " &  [Type] 
    [O-Image] Label Expression using VbNewLine
  5. Use the FormatCurrency function to display the Label as currency.
    "Occupancy Revenue: " & FormatCurrency( [Maximum_Oc] * [Rate])
    [O-Image] Label Expression using Currency
  6. Use the FormatNumber function to display labels for numeric items with trailing zeros.
    "Occupancy: " & FormatNumber([OCCUPANCY_RATE],3) 
    [O-Image] Label Expression with trailing zeros