decimal-date-time validation issue

1462
5
Jump to solution
09-21-2021 10:39 PM
OlivierDemars1
New Contributor III

The xlsform attached returns the following error in Connect (3.12 and 3.13):

OlivierDemars1_2-1632288953596.png

The issue is with this calculation:

decimal-date-time(${test_string})

When replace with the calculation below, the xlsform is processed and works properly:

if(string-length(${test_dob}) > 0 ,decimal-date-time(${test_string}),0)

Cheers,

Olivier

 

 

 

0 Kudos
1 Solution

Accepted Solutions
JamesTedrick
Esri Esteemed Contributor

Hi @OlivierDemars1 ,

The decimal-date-time() function is used for translating across decimal day (i.e. 1= 1 day) and date (epoch ms 1 = 1ms) formats.  Given your form, it appears you want the date() function (to parse a text string into a usable date) within a decimal-date-time function; that being said, there is a similar type mismatch error raised. That can be addressed with an intermediate function; see that attached example

View solution in original post

5 Replies
JamesTedrick
Esri Esteemed Contributor

Hi @OlivierDemars1 ,

The decimal-date-time() function is used for translating across decimal day (i.e. 1= 1 day) and date (epoch ms 1 = 1ms) formats.  Given your form, it appears you want the date() function (to parse a text string into a usable date) within a decimal-date-time function; that being said, there is a similar type mismatch error raised. That can be addressed with an intermediate function; see that attached example

erica_poisson
Occasional Contributor III

Hi @JamesTedrick -

I am having a similar issue...although with time instead of date. I have an existing survey XLSForm which is formatted like this...the calculation works perfectly. The number of minutes elapsed is returned.

erica_tefft_1-1637007459323.png

I want to modify the survey to do some behind the scenes calculations so that field staff do not need to enter the colon (:) between hours and minutes. I've modified the XLSForm to this, and now my line 48, "Time_Elapsed" is throwing a type mismatch error. I can not figure out what I've done wrong as I feel like the results of line 43 (Interview_TimeColon) and line 47 (StartFishing_TimeColon) are not all that different from what was being input in lines 40 and 44 (e.g. 10:45 vs. 1045, which is then calculated to 10:45). 

erica_tefft_0-1637007343836.png

Do you have any suggestions? I did test what you show in the example XLS above, however it did not work - I continue to get a mismatch error. 

Thank you,

Erica
0 Kudos
erica_poisson
Occasional Contributor III

I resolved this using the original set of questions (first screen capture above) in conjunction with an input mask specified for lines 40 & 44. 

Within the bind::esri:inputMask column, I specified 99:99. 

This allows users to just enter numbers, the colon is automatically added and the 'Time Elapsed' calculation works perfectly. 

Erica
0 Kudos
OlivierDemars1
New Contributor III

Thanks @JamesTedrick 

0 Kudos
HaroldHerrera1
Occasional Contributor

Hello, @JamesTedrick 

I have some issues with the calculation of dates in my Survey123 connect.

I'm trying to calculate the time (in days) between to dates field, but, I have the following error:

HaroldHerrera1_1-1639687714831.png

The problem is caused for one field, type "Date", Survey123 cannot convert this specific field in "decimal-date-time". If I set the calculation with another date field, or calculate the field with, UNIX epoch, works fine! I really don't know what's the problem.

Can I share the XLSForm to review this issue?