I have a field with a select_one type. How can I default text into fields based on the select_one choice? I tried looking into If statements but I couldn't find anything.
Solved! Go to Solution.
Hi Jordan,
The selected() function is used to create a condition that is then used by an if() function to set the value:
if(selected(${CALLTYPE}, 'CarbonMonoxide'), 'X', 'Not Carbon Monoxide')
Hi Jordan,
You can calculate field based on previous answers. In the case of a select_one question, you can use either an = to check (ex: ${q} = 'a') or use the selected() function (ex: selected(${q}, 'a') ) as the evaluation part of an if() statement. Note that both values when the statement is true and when the statement is false are needed. Formulas—Survey123 for ArcGIS | ArcGIS provides more documentation.
This doesn't work but how do I default the field to X text? I don't see anywhere in the formula's to populate a value when another field is selected.
select(${CALLTYPE},'CarbonMonoxide', = 'X')
Hi Jordan,
The selected() function is used to create a condition that is then used by an if() function to set the value:
if(selected(${CALLTYPE}, 'CarbonMonoxide'), 'X', 'Not Carbon Monoxide')
Thanks! If anyone comes across this formula please make sure you place it in the "Calculations" field and not the relevant field because nothing will happen.
if(${wradio_current} ='A', 'None', if(${wradio_current} ='B', 'None', 'user input from select_one'))
Is there a way to let the user input the else value?