Conditional if statement: Null in expression

1367
3
06-14-2018 12:02 PM
by Anonymous User
Not applicable

Hi all,

I'm trying to get some conditional if statements to work and I'm receiving an error that there is a NULL in the expression:  if(${SARP_SCORE},1,'No Barrier',if((${SARP_SCORE},< 1) and (${SARP_SCORE},>=0.8),'Insignificant Barrier',if((${SARP_SCORE},< 0.8) and (${SARP_SCORE},>=0.6),'Minor Barrier',if((${SARP_SCORE},< 0.6) and (${SARP_SCORE},>=0.4),'Moderate Barrier',if((${SARP_SCORE}, <0.4 ) and (${SARP_SCORE},>=0.2),'Significant Barrier',if((${SARP_SCORE},< 0.2) and (${SARP_SCORE},>=0),'Severe Barrier','Not Scored'))))))

Any insight?

Thank you!

0 Kudos
3 Replies
JoeBorgione
MVP Emeritus

I think it means that one of the fields you are querying has a <Null> value in it.  

That should just about do it....
0 Kudos
by Anonymous User
Not applicable

Thanks Joe. Do you mean one of the fields has no calculation? It looks like all have somethign in them, there are no NULLs 

0 Kudos
JoeBorgione
MVP Emeritus

That's what I was thinking, yes.  But if that's not the case, take a look at the nests of if statements you have.  It's really easy to miss a paren here or there in this style of scripting.  I know my eyes go crossed in no time!  Give me

if some_condition:
  do_something
elif some_other_condtion:
  do_something_different
else:
  do_something_altogether_different

And I'm a happy guy.  What I've done in the past is write the nested conditions like what you are working with one at a time and try them, until I have the whole enchilada working.

see:  How to use "if" and "then" on survey 123?   Help with IIF statement    /blogs/mapguymike/2017/02/21/nested-iifs-in-attribute-assistant 

https://community.esri.com/message/635756-iif-function-in-dynamic-value-table 

That should just about do it....
0 Kudos