+ Reply to Thread
Results 1 to 5 of 5

Thread: Help with field calculator code (remove characters)

  1. #1
    marie ducharme
    Join Date
    Apr 2010
    Posts
    109
    Points
    3
    Answers Provided
    1


    0

    Question Help with field calculator code (remove characters)

    Hello,

    I would like to populate a field with another field....The field I will be drawing data from is text, and I want to remove the 3 first characters Eg. "AB-589" would become simply "589".


    I have looked at the vb and python string operators and do not see which one would work...Any tips/suggestions? I could do it in (ie, export a dbf, add a field, use the KEN function to remove the characters, add the dbf to the map, join the tables, populate the field)....but I would rather learn how to do it in Arc....

    If somebody can just point/nudge me in the right direction, I would appreciate!!!

    Marishka
    Marishka the MadMapper
    From the Great White North

  2. #2
    Donovan Cameron

    Join Date
    Aug 2010
    Posts
    477
    Points
    40
    Answers Provided
    3


    0

    Default Re: Help with field calculator code (remove characters)

    You can use the mid function as:
    Code:
    Mid([FieldName], 4)
    this function counts the the strings in this order, abcd:1234

    or in python its known as indexing a field:
    Code:
    !FieldName![3:10]
    abcd:0123


  3. #3
    Michael Stead
    Join Date
    Jul 2010
    Posts
    550
    Points
    58
    Answers Provided
    6


    0

    Default Re: Help with field calculator code (remove characters)

    Right([FieldName], (LEN([FieldName])-3))

    ....just because you didn't say anything about string length variability

  4. #4
    marie ducharme
    Join Date
    Apr 2010
    Posts
    109
    Points
    3
    Answers Provided
    1


    0

    Default Re: Help with field calculator code (remove characters)

    Hello and Thank you both for your responses!

    The VB "Mid" worked for me! I tried the python as well, but could not get that one to work...

    The LEN (I assume is short for lenght) is quite interesting to know as well...I am sure I will use in another eventually!

    BTW: I am curious, if you don;t mind....Where\How did you guys build your knowledge of VB? I am curious, as I find the help links proposed by ESRi not super helpful...

    Thanks again for your help! It is much appreciated!
    Marishka the MadMapper
    From the Great White North

  5. #5
    Michael Stead
    Join Date
    Jul 2010
    Posts
    550
    Points
    58
    Answers Provided
    6


    0

    Default Re: Help with field calculator code (remove characters)

    Been mucking with making computers bend to my will since my Dad brought home a Commodore PET back in the late 70's. Jack of all, master of none. No helpful references unfortunately.

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts