AnsweredAssumed Answered

Code Help

Question asked by 691219jakester on Aug 21, 2015
Latest reply on Aug 24, 2015 by xander_bakker

I'm in need of some help.  I have a file with a attribute field named SPCOMP and I need to separate it out.  The SPCOMP field is populated with a string such as "Sb  90Bf  10" or Pj  80Sb  20" or Pj  40Bw  40Sb  20"  etc.  I'm trying to write a code using the field calculator in VB

script that will search through the SPCOMP field for "Sb  90" and populate another field SB with 90 or search for "Sb  60" and put 60

in the SB field.  My code is:

Dim SB

if [SPCOMP] = "%Sb  90%" Then

SB = 90

elseif [SPCOMP] = "%Sb  60%" Then

SB = 60

else

SB = 1

end if

 

When I run this it will populate the SB field with 1 so I think my mistake is with the wildcard search?  Can anyone offer suggestions on this or where I could find answers?  I'm using ArcGIS advanced 10.3.

Thanks

Outcomes