Need help with "if or and" statement

I'm trying to create a conditional statement in a calculate field and can't quite figure it out. Is it possible to do an "if, or, and" statement in XLS Forms? I cant' seem to get the syntax right. I need to return the status of a stream culvert based on information gathered earlier in the survey. I seem to only get a nested if statement to work:

if(${crossing_condition} = 'functioning_properly', 'Green Pipe', if(${crossing_condition}='perched', 'Red Pipe', if(${crossing_condition}='plugged', 'Red Pipe', if(${crossing_condition} = 'collapsing', 'Red Pipe', if(${crossing_condition} = 'overflowing', 'Red Pipe', if(${crossing_condition} = 'log_culvert', 'Red Pipe', if(${crossing_condition}='bad_skew', 'Gray Pipe', if(${culvert_gradient} > 2, 'Red Pipe', if(${const_ratio} > 50, 'Gray Pipe', if(${const_ratio} > 75, 'Green Pipe', 'Red Pipe'))))))))))

I'm working in ArcGIS Survey123 version 3.3.64

Please note if you need support for the ESRI Survey123 product you are probably best going to their support community: https://community.esri.com/groups/survey123

That said, assuming Survey123 supports full XPath expressions, yes you can construct conditional expressions with the 'or' logical operator; eg

if(${crossing_condition}='perched' or ${crossing_condition}='plugged' or ${crossing_condition} = 'collapsing', 'Red Pipe', ...)

1 Like

Wow! thank you for your guidance. I'm pretty new to this and just kicking the tires. This really helped! thanks again!

Thanks again, Xiphware! Here is the statement I developed with your guidance:
if(${crossing_condition}='perched' or ${crossing_condition}='plugged' or ${crossing_condition}='collapsing' or ${crossing_condition}='overflowing' or ${crossing_condition}='log_culvert' or ${culvert_gradient}>2 or ${const_ratio}<50, 'Red Pipe', if(${crossing_condition}='bad_skew' or ${const_ratio}<75,'Gray Pipe','Green Pipe'))

It all seems to work now.

thanks!