Select to view content in your preferred language

Stacked labels with special characters and format tags

1933
2
06-12-2014 06:48 PM
SolBrich
Deactivated User
I'm learning how to label with VBScript. I have to create a stacked label that contains a special character (<) and uses format tags. This is the code I'm using:

Function FindLabel ( [PCELabel1], [PCEValue1], [PCELAbel2], [PCEValue2] )
  theFirstPart = [PCELabel1] & Replace( [PCEValue1],"<","&lt;")
  theSecondPart1 = [PCELAbel2]
  theSecondPart2 = "<FNT name = 'Arial' size = '10'>" & "<BOL>" & "<ITA>" & [PCEValue2] & "</ITA>" & "</BOL>" & "</FNT>"
  FindLabel = theFirstPart & vbnewline & theSecondPart1 & theSecondPart2
End Function

When I click "Verify" in the Label Expression Dialog Box I get exactly what I'm looking for, but when hit "OK" and "Apply" in the Layer Properties Dialog Box to place the labels I get:

GS-4-2014 (23) &lt;0.37
GS-4-2014
(33) <FNT name = 'Arial' size = '10'><BOL><ITA>0

My Data source is a feature class in a file based personal geodatabase. I've attached it for reference. Can anyone please explain why this is happening, and how to fix it? Thanks,
Sol
Tags (2)
0 Kudos
2 Replies
JimCousins
MVP Regular Contributor
I used your expression and dataset, and get this result. Seems fine. Perhaps this is a subset of the full dataset, and there is some other "illegal" characters in the attributes that is causing the formatting issue?
Regards,
Jim
0 Kudos
SolBrich
Deactivated User
Thanks for looking at this Jim. That's the full dataset. The only thing different is I had an SQL query set up to use the script to label features "GSPCELabels.LabelStyle" = 'PCE1 LE 0.37 PCE2 GT 0.37'. Have a good one,
Sol
0 Kudos