I'm trying to do some conditional formatting of an attribute table using Field Calculator. I tried using code below, but am not getting any returns that meet conditions specified (even though the conditions exist). What am I doing wrong? I am new to coding, so please assume I am ignorant to obvious mistakes.
My steps so far:
- Created a new field "Raster_code" (this is the field where I am using field calculator)
- Open field calculator, set parser to Python, enter the following pre-logic script:
def ifBlock(BGCLMTCLBL,STSRSLBLC1):
if 'BGCLMTCLBL' == 'AT' and 'STSRSLBLC1' == '00':
return 1
else:
return 0
Note: "BGCLMTCLBL" and "STSRSLBLC1" are two separate fields. I want to locate records containing a certain combination of values from these respective fields
- Enter the following in the Raster_code block:
ifBlock(!BGCLMTCLBL!,!STSRSLBLC1!)
The result I get is 0 for all records-- in other words, the conditions were not met.
Here is a screenshot of the above-noted fields in my attribute table.