AnsweredAssumed Answered

Survey123 Reset value based on other field conditional

Question asked by mhawks_usfs on Sep 21, 2020
Latest reply on Sep 23, 2020 by mhawks_usfs

Hello,

I have an integer field that is readonly when a previous select_one yes_no field is 'no'.  The select_one yes_no defaults to 'no'.  When 'yes' is selected the integer field activates and accepts values as intended.  However, if the 'yes' is changed to 'no', the integer field retains the entered value.  I need the field to reset to '0' whenever the yes/no field is set back to 'no'.  Is there any way to force or reset, or build a calculation that sets the value back to '0' on that condition?

Assume:

DevFeature_YN: is the select_one yes_no field

DevFeature_count: is the integer field with readonly when ${DevFeature_YN} = 'no'

 

So, if DevFeature_YN is set to 'yes' and DevFeature_count is set to 5, then user realizes they are in the wrong field and sets DevFeature_YN back to 'no', how do I reset DevFeature_count back to 0?

I tried a calc statement in the DevFeature_count calculation field, but it had an error: 

   if(${DevFeature_YN} = 'no',0,${DevFeature_count})

I tried a using once(), but it also had an error: 

   if(${DevFeature_YN} = 'no',0,once(${DevFeature_count}))

I tried a the self notation, but it also had an error: 

   if(${DevFeature_YN} = 'no',0,.)

 

I may be missing something obvious, but am totally at a loss.

 

Michelle

Outcomes