type mismatch - converting to date

203
3
03-26-2019 04:40 PM
Highlighted
New Contributor III

Hi,

I have a database with some information of some people, within the birthday of them, but I want to convert this field that is a String into a Date (type field). For this, I am using the function date(). But I am receiving this error when I try to execute the sheet.

Here is the sheet extract:

With results of the two first lines (field_4 and field_4a):

What I try to do in the field_4a is to subtract only the date of this data, so the function would work.

So I thought that with the result of dia (field_4a), the function date() could calculate the date field type because when I fill this field (4a) by hand it works!

Ok, it does not work perfectly (it subtracts a day but I can handle it), but at the least, the function read the string and converts it into a date. Have you any idea of what it is happening when I try to execute the first extract of the sheet that I showed to you? Thank you very much!

Reply
0 Kudos
3 Replies
Highlighted
Esri Esteemed Contributor

Hi,

On the day being off - Survey123 uses UTC time and a date is stored as midnight; if you are located in the western hemisphere, the local time displayed will be the day before (as midnight UTC is still the previous day). 

On the time calculation - I'm not seeing the behavior when I create a form with the formulas (excepting the pulldata function). Can you share a copy of the XLSForm that does not validate?

Reply
0 Kudos
Highlighted
New Contributor III

Hi! I send you the file of the survey (but I only let four lines in the .csv file)

Atencion domiciliaria Cali.rar - Google Drive 

Reply
0 Kudos
Highlighted
New Contributor III

I'm having a similar problem. I have a form that calculates a person's age from a date of birth text field. It works in my original form, but not when I copy and paste into my new form. I'm getting the same error a "type mismatch."

I tried deleting the cells and then rewriting from scratch and that didn't work.

Cheers,

RyanE

Reply
0 Kudos