I have three fields that I am trying to label and one that I am trying to round to the nearest whole number. Here is what I have so far:
"Pipe ID: " + [ID_PIPE] & vbNewLine & [DIAM_INCH] + " in." & vbNewLine & Round ( [LENGTH_FT] ) + " ft."
I keep getting an error that says:
Error 1 on line 2.
Type mismatch: 'esri_2'.
I'm pretty sure it is related to the Round ( [LENGTH_FT] ) but I don't know what I'm doing wrong...
You shouldn't be using the "+" in VBA to combine text, only use "&" for this. Also I am not sure if you have to specify the number of decimals when rounding a value. Try this:
"Pipe ID: " & [ID_PIPE] & vbNewLine & [DIAM_INCH] & " in." & vbNewLine & Round([LENGTH_FT], 0) & " ft."
"Pipe ID: " & [ID_PIPE] & vbNewLine & [DIAM_INCH] & " in." & vbNewLine & CInt([LENGTH_FT]) & " ft."
I believe if using the field calculator it only accepts Vbscript which is not as rich in functions as VBA or VB ... The CInt will perform the .5 or higher rounding automatically.
In ArcGIS Pro you would probably want to use ArcGIS Arcade | ArcGIS for Developers , since that seems to be the future:
"Pipe ID: " + $feature.ID_PIPE + "\n" + $feature.DIAM_INCH + " in." + "\n" + Round($feature.LENGTH_FT, 0) + " ft."
I am an old time VB'r Round function was not initially part of vbscript got added later on! I am a dinosaur too and have used the CINT function for quick rounding for many years In any event... I am pretty much switched over script wise to python now; application wise I am still using vb.net or until they take that away too!
Hi Ted Kowal , I think it is a good thing that you switched to Python for scripting.I did that a number of years ago and I'm glad I did.
Using VB.Net and ArcObjects is something which is not too future proof. It might be time to switch over to Pro and explore the possibilities. There is a webinar tomorrow that might be interesting (Building ArcGIS Pro Add-Ins and Solution Configurations):
I have yet to make Pro work for me... I spend more time trying to figure out why it crashes on me! So atm I have put it aside till there is more stability. I will keep your thoughts in mind and look at the webinar. Thanks
Hi Dan Patterson , actually it is the way is going and although in some cases it might require some adaption, there are some nice things it offers. See below a document I published this week with some examples:
And in version 10.6, ArcGIS Pro 2.1, there will be something new called Attribute Rules which is based on Arcade too (initially designed as functionality for the ArcGIS Utility Network Management Extension, but it will be a feature available throughout the platform).