now() for date field in repeat causing issues only in webform

11-26-2020 03:02 PM
Occasional Contributor II

Hi I'm having a issue with .<now() constraint in datetime field within repeat, but the issue occurs only in the webform. 

Within a repeat, a group has a shiftstart datetime and shiftend datetime, and a field that calculates minutes elapsed {ShiftMinutes}. Outside the group but inside the repeat, theres a field {TotalShiftMin} which calculates total sum of the {ShiftMinutes}. This field {TotalShiftMin} need to be inside the repeat, so that it outputs onto the same sublayer as all the other fields. As below, the starttime has now() to ensure current time to appear, and endtime copies starttime so the respondent can alter endtime from starttime. 


Below is example of Survey123 Connect displaying fieldapp example, which works fine. The correct {ShiftMinutes} calculation appears, and when more repeat added, {TotalShiftMinutes} returns correct calculation. 

27 1.JPG27 2.JPGI've been checking the field functions on Connect so far since I didn't want to publish before finalising everything, which seems to have been a mistake since webform seems to work completely differently to field app on too many aspects. Below is what the webform is returning:

Repeat entry 1 on the left - all appearing fine, including {TotalShiftTime}


But once I click the plus button for repeat entry #2 (image on the right), the initial time entries in entry 1 are erased and replaced by current time, resulting in {ShiftMinutes} and {TotalShiftMinutes} also returning 0. 

In the field app the subsequent repeat entries don't affect the previous entries. So why is this occurring in the webform? Any idea on solutions to this?




0 Kudos
1 Reply
Occasional Contributor II

Additionally, the {TotalShiftMinutes} which work fine on Connect doesnt work on the webform. e.g. When Repeat entry #1 minutes is 15, {TotalShiftMinutes} also shows 15. When Repeat entry #2 is added and its minutes is 20, the {TotalShiftMinutes} shows 20 rather than 35.

I can understand that this is possibly caused by the {TotalShiftMinutes} being inside the repeat rather than outside - but the current schema works fine in the Connect. 

0 Kudos