Select to view content in your preferred language

Conditional Answers

270
1
12-30-2022 09:49 AM
FloraGibbs
Emerging Contributor

I am trying to have a spawning success question return unknown if the sex of the fish is male or unknown, but remain open to all options if female is selected. Here is my code:

(if(selected(${sex}, 'Male'), 'Unknown', if(selected(${sex}, 'Unknown'), 'Unknown'))) 

I am getting the following error: b"ODK Validate Errors:\n>> Something broke the parser. See above for a hint.\nError evaluating field 'spawn_success': The problem was located in calculate expression for ${spawn_success}\nXPath evaluation: cannot handle function 'if' requires 3 arguments. Only 2 provided. 

0 Kudos
1 Reply
ZacharySutherby
Esri Regular Contributor

Hello @FloraGibbs

The second if() formula only has 2 arguments. I would suggest the following syntax for the whole calculation: 

if(selected(${sex}, 'Male') or selected(${sex}, 'Unknown'), 'Unknown', '')

Thank you,
Zach