HELP ME! PLEASE!
dim n
if ([CATEGORIA_IPD] = 'MEDIA') And ([IVR]= 'PARCIALMENTE TRANSFORMADO') Then
n = 20
end if
First, you are using VB Script parser, not Python (you have shared in Python space).
Try Replacing And with &.
If that doesn't solve the issue, also replace 20 with "20"
How to do with Python?
Did you try the above steps in VB script parser? Is it still throwing error message?
If it is not a mandate to do everything in Field Calculaor, you could also Select by Attributes.
Expression:
[CATEGORIA_IPD] = 'MEDIA' AND [IVR]= 'PARCIALMENTE TRANSFORMADO'
Once the records are selected, you could open Field Calculator for R_1 and define 20 as the value.
You have not assigned a value to a field. Is 'n' your new field?
syntactically it should be
python parser! NOT VB
def calculate(field1, field2):
if (field1 = 'MEDIA') and (field2 = 'PARCIALMENTE TRANSFORMADO'):
n = 20 # or '20'
else:
n = ????? # what do you want? "" or something else
return n
Expression box
def calculate(!CATEGORIA_IPD!, !IVR!)
you have to provide an option for the case where they are not equal to your queries. Move on to python. The function is the first 6 lines, and what goes into the expression box is line 9
The only thing completely wrong in your original example is that VBScript uses double quotes for strings, not single quotes (Python uses either). You also don't need to 'dim' in VBScript, that's a VBA thing. You will also get a warning if the function returns nothing, but you can click past that.