Using Field Calculator vb to check for name with /n in the string

1901
3
Jump to solution
01-07-2016 11:17 AM
TiffanySelvidge1
Occasional Contributor III

I am calculating values for a field (Score) based upon the names from another field (Modified). One name is "blaugh\nblaugh". Field Calculator keeps treating the name as having a new line command.

I have tried using Like, Right, Contains, etc but the Field calculator does not seem to be able to use those commands. I am stumped.

Ex1: elseif [Modified] = "blaugh\nblaugh" then Score =7

Ex2: elseif Right( [Modified], -6) = "blaugh" then Score =7

Ex3: elseif [Modified] LIKE "*nblaugh" then Score =7

I am using vb in ModelBuilder and ArcCatalog 10.3.1

Any help will be appreciated.

0 Kudos
1 Solution

Accepted Solutions
TiffanySelvidge1
Occasional Contributor III

Darren,

Got it!

I took your code and modified it to:

elseif InStr( [Modified], nblaugh) then Score =7

Thank you very much for your help. I had been puzzling over that problem for some time.

View solution in original post

3 Replies
DarrenWiens2
MVP Honored Contributor

Try:

elseif InStr([Modified], vbNewLine) then Score =7

TiffanySelvidge1
Occasional Contributor III

It still doesn't work.

Field Calculator accepts the code but does not recognize any relevant records.

0 Kudos
TiffanySelvidge1
Occasional Contributor III

Darren,

Got it!

I took your code and modified it to:

elseif InStr( [Modified], nblaugh) then Score =7

Thank you very much for your help. I had been puzzling over that problem for some time.

View solution in original post