AnsweredAssumed Answered

Problem with Calculate Field tool

Question asked by pbuxton on Jul 16, 2014
Latest reply on Jul 16, 2014 by pbuxton

I am attempting to do a field calculation in 10.1 using the Calculate Field tool with a VB script code block. If I run the code in the Field Calculator tool within ArcMap, it works perfectly. However if I run exactly the same script in the Calculate Field tool within a model, the tool appears to run, but the resultant fields are all empty. If I run the Calculate Field tool independently (ie not in the model), it fails with "Error 000622 ....parameters are not valid" and "Error 000989 CalculateField cannot use VB expressions for services". The script is essentially concatenating two fields into a third field ([ChemVal] and dealing with the fact that one of the two source fields can have Null values which need to be converted to a string before concatenation.


The expression is:

ChemVal = NewVal


and the code block is:

Dim NewVal

If [Chem_Value_Range] = "" Then

NewVal = String( [Chem_Value_Range] ) & [Chem_Value]


NewVal = [Chem_Value_Range] & [Chem_Value]

End if