[GIS] Adding Values together using FindLabel (VBscript) function of ArcMap Label Expression

arcgis-desktoparcmaplabelingvbscript

I would like to add values from multiple fields in a shape file and display the result as a label

This is what I'm doing currently::

if ( [SwineGesBo] + [SwineSowLt] > 0) then 
    output = output & [SwineGesBo] + [SwineSowLt] & "Sows"

Unfortunately the code here only puts the two value together and does not sum them.

How can I do this?

Best Answer

From the Help button on the Label Expression dialog:

Field values are automatically cast to text strings. Therefore, if you wish to use a numeric value in an arithmetic operation, or when making a comparison, you will need to cast it back to a numeric data type.

In place of

[SwineGesBo] + [SwineSowLt]

try using

cint([SwineGesBo]) + cint([SwineSowLt])