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.
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')
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?
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.
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')
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.
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.