0

I am trying to clean up the labeling for a city zoning map using ArcGIS Online. To do this I need to trim the property address to only the numeric values, which has been accomplished, but due to incomplete data some values in the Property_Address field do not have street address number so the the expression will display the first four characters of the name of the street address. I need this second expression to be able to determine if numerical or text characters will be output and if there are no numerical characters and text is present, then those characters need to be hidden.

Left($feature.PropertyAd,4)

IIF(Left($feature.PropertyAd,4) != 
1

First check for a space in the address usually the numbers are first, then check if the fist split is number or string them do stuff accordingly I wrote something short and tested in ESRI playground.

var str = '1234 N. Street Name'
var index=Find(' ', str , 0)
var nfirstSplit = Number(Split(str,' ')[0])
var tfirstSplit = Text(nfirstSplit)
IIf(index>0, IIf(tfirstSplit=='NaN','',nfirstSplit),'if no space check if string is number and do stuff')

In VB Script

Function FindLabel ( [ADDRESS] )
  newstrings = Split([ADDRESS]," ")
  For Each newstring In newstrings
    If IsNumeric(newstring) Then
      anotherstring = ""
    Else
      anotherstring = anotherstring +" "+ newstring + " "
    End If
  Next

  FindLabel = anotherstring

End Function

!Make Sure You Are Using Advance Setting In Label]1

  • how would you transpose this to a VBscript syntx? – Biancheff Aug 29 at 13:11
  • I have been playing around with using some other VB Script variations. Basically I am doing all my labeling in ArcMap using VB Script and Python, then attempting to transpose the expression in ArcGIS Online. Seems redundant, but this way I am able to learn / analyze the what is going on in 3 different languages that are calling out the same expression. – Biancheff Sep 3 at 13:27
  • Function FindLabel ( [AddressNumber] , [ParcelNumber] ) If ( [ParcelNumber] <>"") then FindLabel = [AddressNumber] & vbNewLine & "<ITA>" & [ParcelNumber] & "</ITA>" Else FindLabel = [AddressNumber] FindLabel = [ParcelNumber] End If End Function – Biancheff Sep 3 at 13:29
  • This is the expression I am currently working with. It works fine, but I would like to be able to only show ParcelsNumbers if there is no AddressNumber. I figured that the expression would be a simple (which I assume it is, since it is a basic IF-THEN), but when I rearrange it to only show ParcelNumbers is there is not AddressNumbers, it only returns ParcelNumbers. Based on the above expression, how would I go about re-writing it to. – Biancheff Sep 3 at 13:39
  • And you need this in VBScript, Python and Arcade?, do you have a sample from the table you could share so I don't have to make up data. – Gary Lester Sep 4 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.