0

I have a VB script used by ArcGIS 10.2 for Desktop to label different types of streets based on vales present in a specific field. I am a novice at Python but VB and JavaScript are beyond me. I need this to be JavaScript for older version of ArcGIS. Here is the script in VB:

Function FindLabel ( [STREETNAME] )
' Extracts number from [STREETNAME]
' ---------------------------
  Dim sIn, sNew, i
  sIn = [STREETNAME]  ' input field value
  sNew = ""  'result

  i = 1

  ' check if char is numeric
  While i <= Len(sIn)    
    If IsNumeric(Mid(sIn, i, 1)) Then
      sNew = sNew & (Mid(sIn, i, 1))
    End If
    i = i + 1
  Wend

  FindLabel = sNew

End Function
  • 1
    Can you please clarify I need this to be JavaScript for older version of ArcGIS? What older version of ArcGIS do you mean? To my knowledge, ArcGIS Desktop doesn't support (and has never supported) JavaScript labelling. – Stephen Lead Jan 5 '15 at 22:08
3

Reading through the answer to this question may help you: https://stackoverflow.com/questions/20601997/how-to-approach-converting-vbscript-to-python-code

Break down the labeling script into its parts (variables, functions, etc.) and then write that in pseudo-code. Since you are not familiar with JavaScript syntax, the Esri Help is a good place to start: http://resources.arcgis.com/en/help/main/10.2/index.html#//00s800000027000000

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.