HELP ME! PLEASE!
dim nif ([CATEGORIA_IPD] = 'MEDIA') And ([IVR]= 'PARCIALMENTE TRANSFORMADO') Thenn = 20
end if
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.
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!)<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
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
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.
Did you try the above steps in VB script parser? Is it still throwing error message?
How to do with Python?
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"
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.