we need just like the following, only with multiple records selected... have tried the "xyz" in (1,2,3,4,5) SQL code but of course VB Script wants something else.
dim f2
if [field1] = "foo" then
f2 = "bar"
end if
Screen shot of this being used in the field calculator.
Answer
If you like SQL, you can apply a Definition Query:
IN('x','y','z')
then process your field calculator results. Only the filtered records will be modified.
If you want Python, it will look similar to the SQL:
if !field1! in ("x","y","z"):
f2 = "field1 is yep"
[Added as solution] Or as a 1-liner without any preprocessing required:
'yes' if !field1! in ('x','y','z') else ''
No comments:
Post a Comment