Auto Populate String Question

349
4
Jump to solution
05-15-2023 09:22 AM
icf_Eric_Link
New Contributor III

Helle,  I am looking to auto populate a text question based on the answer from a select one question.  So basically, if no is selected from Question 1 (yes/no) then populate text question 2 with "Not Applicable".  If yes is selected then text question does not get auto populated.  

I have tried using if(condition, a, b) statement but can't seem to get it to work properly.  Any suggestions would be appreciated.

Thanks!

0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Esteemed Contributor

For some reason you have the calc in the relevant column.

Move to the calculation column then you do this.

if(selected(${Tribal_Monitor_Present},'No'), 'Not Applicable', '')

What this does is if No set to Not Applicable else empty string.  This will allow the user to then add something.  Now it will then show a refrrsh icon that if the user taps it then it goes back to blank.  But they can add something and leave it and it will be saved.

I know it seems funky but this is how to say make it Not Applicable or do nothing.  No other way to do it.  The way you have it written is a dependcency cycle which can hard to explain.  You cannot say make it this value else keep that old value since once the if runs it is too late and the old value is gone already.

Hope that makes some sense it can be a tough concept.

View solution in original post

0 Kudos
4 Replies
Richard_Purkis
Esri Contributor

Hi @icf_Eric_Link 

I'd recommend sharing your form so it is easier to test and provide you with a solution

Thanks

0 Kudos
icf_Eric_Link
New Contributor III

Hi Richard, thanks for your response.  I have attached my form and the rows colored in orange are the ones I'm looking to autopopulate.  Both text questions would need to be populated with Not Applicable if  "no" select one question is selected.  

0 Kudos
DougBrowning
MVP Esteemed Contributor

For some reason you have the calc in the relevant column.

Move to the calculation column then you do this.

if(selected(${Tribal_Monitor_Present},'No'), 'Not Applicable', '')

What this does is if No set to Not Applicable else empty string.  This will allow the user to then add something.  Now it will then show a refrrsh icon that if the user taps it then it goes back to blank.  But they can add something and leave it and it will be saved.

I know it seems funky but this is how to say make it Not Applicable or do nothing.  No other way to do it.  The way you have it written is a dependcency cycle which can hard to explain.  You cannot say make it this value else keep that old value since once the if runs it is too late and the old value is gone already.

Hope that makes some sense it can be a tough concept.

0 Kudos
icf_Eric_Link
New Contributor III

Ah thanks Doug.  This makes sense and helped me out.  Much appreciated.