Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Apologies if this has already being asked but I couldn't find a page pointing to this problem.

enter image description here

I'm struggling with the python syntax in the Calculate Field so that, in the table above:

if b, c, d, or e are NOT NULL populate the Summary field with "Verified" else populate Summary field with "In Progress"

So if any of the B, C, D or E columns contain NULL the Summary field will read "In Progress".

I believe this should be something along the lines of:

def Reclass !SUMMARY!: if [ !B! , !C! , !D! , !E!] <> NULL !SUMMARY! = "Verified: " else !SUMMARY! = "In Progress: "

Any help is greatly appreciated :-)

share|improve this question

2 Answers 2

up vote 8 down vote accepted

Run the field calc on the Summary field. Use Python as the parser and check the Show Codeblock box.

For the Pre-Logic Script Code put:

def Reclass(B, C, D, E):
    if None not in (B, C, D, E) and "" not in (B, C, D, E):
        return "Verified"
    else:
        return "In Progess"

Then put this in the bottom box:

Reclass(!B!, !C!, !D!, !E!)

The bottom box with the ! contains the actual field names that get passed into the Reclass function in the top box.

I included the "" not in (B, C, D, E) as a check specifically for text fields that are blank but don't have the Null value, if you need it.

share|improve this answer
1  
Thanks Ian. That worked a treat... –  spk578 Aug 8 at 8:52
    
@Simon Good to hear! –  ian Aug 8 at 8:53

This answer is not meant to steal from @ian, but it shows a little bit easier way to write the code that he provided... instead of using a code block (which can be a pain in the butt sometimes when trying to write it in a standalone script...) you can rewrite his code in a single line as:

"Verified" if None not in (!B!, !C!, !D!, !E!) and "" not in (!B!, !C!, !D!, !E!) else "In Progress"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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