1

I would like to do a simple calculation using VB script or Python. Here is a screenshot of my field calculator which continuously seems to run into errors. Basically for the SITE CLASS field I would like to assign all the ST as "Optimal", all the WT as "Subsuitable" and all the CT as "Unsuitable".enter image description here

2
  • 1
    Can you edit your post to include all the text in the Pre-Logic Script Code box? Right now it's getting cut off, so it is hard to see what you are currently doing. Sep 8, 2021 at 12:58
  • 3
    (You should always try to add the code as text instead of screenshots of it, see: stackoverflow.com/help/minimal-reproducible-example)
    – BERA
    Sep 8, 2021 at 13:21

1 Answer 1

2

I think you are mixing SQL, VB and python syntax. Use python parser and:

Pre-Logic:

def reclass(siteclass):
    if 'ST' in siteclass:
        val = "Optimal"
    elif 'WT' in siteclass:
        val = "SubSuitable"
    else:
        val = "Unsuitable"
    return val

Call with

MACSITE_CL=

reclass(!SITE_CLASS!)
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.