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
VB script requires double quotes.
Try:
Dim Status
IF [SymbolID] = "0" THEN
Status = "In Construction"
Else
Status = "Planned"
End If
Thanks. I tried , but still gives the same message.
Also, I noticed your original EndIf needs a space in it: End If
I tested it here with a file geodatabase and a sql server feature class and it worked for me. What version of ArcGIS are you using?
I wonder why it doesn't work for me. I also tried different types of field (Double, Text, etc.). I work with Arc GIS 10.1.
Since you're returning text, your field must be text.
Remove the "Dim..." line. Dim is for VBA, not VBScript.
Thanks. I have also tried so, but didn't work either.
Here is a screenshot of what worked for me using the Calculate geoprocessing Tool in 10.3.1...
In this case SymbolID is a text field and Status is a text field length of 50 that I added to my Zoning feature class.
If you have not already, try restarting ArcGIS to make sure nothing is locked or old variables get cleared from memory.
Thanks again, Christopher. I followed all the steps you mentioned. Also restarted ArcGIS, but unfortunately didn't work again. Here is a screen shot:
Aza, what Joshua Bixby said below... you only need to put the variable name "Status" into the expression. Post what the error message is if you still do not get that to work.