Hi all,
I'm working on building a survey using a feature service that has two fields:
'Start_Date' and 'Start_Time' (both using data type "Date" set in ArcPro)
Ideally, I would have preferred to use "Date only" and "Time only" fields, but unfortunately, "Time only" isn't supported when publishing web layers to Portal.
That being said, I'm running into an issue with recording values for the 'Start_Time' field. The Survey123 Web App records values differently (or not at all) compared to Survey123 Connect or the Field App. Here's a breakdown of the questions involved:
type | name | default | calculation | constraint | bind::esri:fieldType |
text | time_24h | | | (int(substr(.,0,2))<24) and (int(substr(.,3,5))<60) | null |
date | date_placehold | 12/31/1899 | | | null |
dateTime | start_time | | if(${date_placehold} != '' and ${time_24h} != '', concat(format-date(${date_placehold}, '%Y-%m-%d'), 'T', format-date(${time_24h}, '%H:%M:%S')), '') | | esriFieldTypeDate |
Essentially, the user will only see the ${time_24h} field. They will enter the time in 24-hour format, and this time will then be joined with a default date of 12/31/1899 to create the ${start_time} field. This is ultimately the value that gets stored when the user submits the survey. I have to use the esrifieldTypeDate because of the limitation when publishing a web layer with the "Time only" data type. It seems a bit convoluted, and I'm open to any better alternatives to achieve this outcome.
So here's the issue between the web app/connect or field app:
In connect, the user should be able to type 13:30 into ${time_24h} to trigger the calculate on ${start_time}. This results with "Saturday, December 31, 1899" "1:30PM". This functions exactly how I intend on connect/field app.
However, in the web app, the user types 13:30 into ${time_24h} and no calculate is performed in ${start_time}.
I've read that dates are stored exclusively as decimal dates on the web app, so I think this is where my problem arises. Any input or suggestions to modify what I have would be appreciated.