deleted-user-ugCMpXci8bn5

parse text field in Field Calculator w/ VB or Python

Discussion created by deleted-user-ugCMpXci8bn5 on May 10, 2012
Latest reply on May 25, 2012 by deleted-user-ugCMpXci8bn5
Hello,

I would like to create a new field by trimming the string from another field form a given set of characters..

For example:
1 HOUR PARKING 10AM-7PM EXCEPT SUNDAY (ARROW)(SUPERSEDED BY SP-133EA)

would be trimmed at "(SUPERSEDED..."
to become
1 HOUR PARKING 10AM-7PM EXCEPT SUNDAY (ARROW)

in the new field.
I currently have this VB statement in the pre-logic block:
s = Instr (1, [SignDesc1] , "SUPERSEDED BY")

with this statement below in the code:
Left ( [SignDesc1], s)

This results in a new field with
1 HOUR PARKING 10AM-7PM EXCEPT SUNDAY (ARROW)(S

and several SQL errors.

I think at least one problem is I am having trouble with the '(' character..I have tried a few escape character methods (using '\', or double quotes) but none have worked...

Any ideas? Thanks! // Jason

Outcomes