mercredi 25 février 2015

Trouble with VBScript in Field Calculator


What is wrong with this VBscript in the field calculator?


ColumnC=



if [ColumnB] > 0 then
[ColumnC] = [ColumnA] / [ColumnB]
endif


Each time I receive this syntax error message:



  • Error 000539: SyntaxError: invalid syntax (expression, line 1)

  • Failed to execute


All 3 columns are the double field type, although they vary in precision and scale. I have tried converting the columns to float type and doing the same expression. I received the same error messages.


Is this expression entered correctly? For the first line (starting with 'if'), the script is left-justified. For the second line (starting with '[ColumnC]) I included four spaces before the script. In the codeblock on the field calculator the equation does extend into the third line (and is left justified) simply because the actual name I use for !ColumnB! is longer.


Is this script correct?


Feel free to offer corrections in either VB Script or python. Thanks!





Aucun commentaire:

Enregistrer un commentaire