Concat time fields?

330
1
09-08-2023 10:49 AM
ChadC
by
New Contributor

I am attempting to concat two time field(s) to a text field so the end user can populate business hours. When I preview the expression in Survey123 Connect, I am able to see the range of business hours (24 hr clock), as expected. However, when I publish the Survey to AGOL (and open it in a web browser), I am getting an error: 'Invalid Date' - 'Invalid Date'. This is puzzling!

concat(format-date(${morninghrs}, '%h:%M'), ' - ', format-date(${eveninghrs}, '%h:%M'))

I have also made attempts to concat the function with the following expression:

concat(string(format-date(${morninghrs}, '%h:%M')), ' - ', string(format-date(${eveninghrs}, '%h:%M')))

Any help would be greatly appreciated! 

0 Kudos
1 Reply
ChipMorgan65
Occasional Contributor

Hi,

   I'm unsure why the web version of Survey 123 is behaving like this.

   A possible workaround could be to use two text fields to set the starting and ending hours as opposed to computing them from dates. You could use a pair of select_one questions that share a common set of choices for the hours of the day. This would simplify data entry and improve data quality. Admittedly, this might not work for your situation.

0 Kudos