Field Calculator VB Script

6976
13
03-31-2016 08:03 AM
AzaN
by
New Contributor III

Hi All.

I am trying to calculating a field ([Status]) based on another field ([SymbolID]). The code that I am using is as below:

Dim Status

IF [SymbolID] = '0' THEN

Status = 'In Construction'

Else

Status =  'Planned'

EndIf

But I keep receiving failure messages. Could you please help me with that?

Thanks in advance,

Aza

0 Kudos
13 Replies
AzaN
by
New Contributor III

0 Kudos
ChristopherThomas
New Contributor III

Aza,

What kind of data are you using this tool on? Is this a feature class in a file geodatabase? Excel Table?

The results window shows "CCTVs\CCTV Phase 5C\CCTV Phase 5C".

I usually try to avoid spaces in the names when scripting or gp tools are involved. I don't think that would be the problem, but you might try creating a copy with a different name without spaces and give it a try.

Chris

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

It helps to include specific error messages, rather than just saying you got an error message.

You don't put all the code in your Expression dialog, just "Status"

DanPatterson_Retired
MVP Emeritus

time for a python example?