Survey123Connect error: refresh a calculated value in a select_one field after changing the value that triggers the calculation

632
4
Jump to solution
01-26-2022 02:11 AM
HélèneTouyéras
Occasional Contributor II

Greetings Survey123 Friends!


A user points out that a calculated value in a select_one field is not refreshed when he changes the value that triggers the calculation...

The use-case is in the attached simplistic example form , and is illustrated below:


form_before.PNG 

 

 

 

 

 

 

 

 

 

 

 

 

form_after.PNG

 

Would someone have a nice workaround to force-refresh the field?

Does the calculation expression need to be more elaborated?

(The real form uses the body::esri:visible field to mask out the field if the user does not need to interact with it (i.e. if producer = provider), so that the erroneous value is kept on record unknowingly, and the user cannot refresh the field).

 

Many thanks!

Hélène.

 

0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Notable Contributor

If it is not visible to the user change it to a Type of calculate.  These refresh better.  In the sample above you should get a recalc button?  A user can override a calc and that is what is happening.  

View solution in original post

4 Replies
Jcordovafredes
Occasional Contributor II

Hello, necessary to see the xls form to see how the calculations are.
Normally in the relevant column you are given the conditions to open cascading questions, which is what you show in the example.

0 Kudos
HélèneTouyéras
Occasional Contributor II

Apologies, I forgot to attach the form - thanks for catching me there!

I have added it to the post.

 

0 Kudos
DougBrowning
MVP Notable Contributor

If it is not visible to the user change it to a Type of calculate.  These refresh better.  In the sample above you should get a recalc button?  A user can override a calc and that is what is happening.  

HélèneTouyéras
Occasional Contributor II

Thanks @DougBrowning ! I need to show the Q3 field for cases where the producer is not the seller.

You are right: adding a calculate field in the form allows to report the correct value.

So one solution for clean data is:

- add the calculate field to store the correct value in the feature service

-degrade the second select_one (Q3) as a NULL field, to avoid storing potentially erroneous values in the feature service.

I would have liked to make it in one field, though, as NULL field are not well handled when updating feature from the inbox (and thus, neither are NULL field dependant fields).

I attach to the corrected XLS here.

My thanks ! 🙂

Hélène.