Select to view content in your preferred language

Survey123 calculationMode=whenEmpty Not working

633
3
05-17-2023 12:51 PM
chrisblinn_kci
Emerging Contributor

I have a survey where the user can change the status, and I am tracking the dateTime of the status change in a hidden field. The problem is when a user changes the status, the dateTime field in reference to the existing status value is set to null when the form is submitted.

The way this is setup is I have a select_one field with my status values.

GDXAdmin_0-1684352250206.pngGDXAdmin_1-1684352284057.png

For each status value, I have hidden dateTime fields with a calculation value of now(), and a relevant value that matches the selected status value.

GDXAdmin_2-1684352610533.png

Once the status has been selected and submitted, I want the dateTime field to calculate and then never change.  From the description of the calculateMode=whenEmpty, I thought this was the correct choice.

However, if I change the status from say 2. to 4., the dateTime value for 2. becomes null, and 4. populates with the now value.

Before changing and submitting:

GDXAdmin_3-1684352784497.png

After changing and submitting, note how 2. is blank:

GDXAdmin_4-1684352835990.png

I've tried other calculateMode values and nothing works.  Any ideas?

Tags (2)
3 Replies
chrisblinn_kci
Emerging Contributor

An update:

If I change the input type to dateTime, and make the calculationMode=auto, then the user can click the Recalculate button and submit.  This preserves the values in other date fields, but I would still like the calculation for the new status to automatically calculate.

0 Kudos
JerrySneary
Regular Contributor

Hi, 

The parameter calculationMode=whenEmpty has now stopped working for me too. It's been working for almost a year. If I turn off readonly it works. I don't want this field to have the ability to be recalculated. If any one has any ideas I'd love to hear them.

 

Jerry

JonCardiello
Emerging Contributor

Hey there,

I just wanted to add that calculationMode=whenEmpty has also stopped working for me. It had been working but no longer is.  Wondering if anyone got to the bottom of this?

Thanks,
Jon

0 Kudos