[GIS] ArcMap field calculator VBScript

arcgis-10.0vbscript

I want to do some advanced level scripting with VBA in the field calculator. I have done a simple coding in the code block. Here is the codes.

dim X
  if [Name]="University" then
    X=101101
  elseif [Name]= "College" then
    X=101102
  elseif [Name]= "Medical College" then
    X=101103
  elseif [Name]= "School" then
    X=101104
  else
    X=""
  end if

This is working correctly. But I want to do something more. Those are-

  1. If the Name field contain the word University or College or Medical College or School then X return the expecting value.
  2. Is it possible to create new fields through VBScript? If its possible then the X will split into two from its middle (3-3) and put the value in the newly generated column/fields.

If this possible it will help me a lot.

Thanks in advance

Best Answer

Yes and no. You can create fields from a standalone VBScript, but not within Field Calculator. See link below for how to write VBScript:

Creating the geoprocessor object

I would recommend learning and using python instead for the task that you are trying to do. You could use a SearchCursor to search for the field values, then add your fields based on the SearchCursor result and then calculate.