Hello,
I have been assigning sample ID using a calculate field from the date and time as shown below. It used to work perfectly (although made a very long sample ID) However, since the last update it no longer works and just returns "GO_" in our surveys. I have a feeling this has something to do with the change from epoch? But I scarcely know what I am talking about. At any rate, can you suggest a fix? I also attached the full .xlsx just in case.
Thanks!!
Lori
type | name | label | hint | constraint | constraint_message | required | required_message | appearance | default | readonly | relevant | calculation | choice_filter | repeat_count | label::language1 | hint::language1 | media::audio | media::image | body::accuracyThreshold | bind::esri:fieldType | bind::esri:fieldLength | bind::esri:fieldAlias | body::esri:inputMask | ||||||||
dateTime | DATES | Date and time | yes | now() | yes | ${specimen_collected} = 'yes' | |||||||||||||||||||||||||
text | calc_sample_id | Specimen label | ${specimen_collected} = 'yes' | concat("GO","_", date(${DATES})) |
Solved! Go to Solution.
Hi Lori,
The date function you have used in your concat calculation would return an epoch date, and if that is what you are after you can simply conact the ${DATES} field and it will return the epoch string from the previous question.
If you want to return and concat a formatted date, you can use the format-date function: format-date(${myDateQuestion},'%Y/%m/%d %H:%M') for example. Depending on the format you want to display you can change params and order for the returned date string format.
The updated calculation would be as follows: concat("GO","_", format-date(${DATES},'%Y/%m/%d %H:%M'))
More information about the format-date function can be found here: https://community.esri.com/groups/survey123/blog/2016/04/17/dates-and-time-in-survey123-for-arcgis
Regards,
Phil.
Hi Lori,
The date function you have used in your concat calculation would return an epoch date, and if that is what you are after you can simply conact the ${DATES} field and it will return the epoch string from the previous question.
If you want to return and concat a formatted date, you can use the format-date function: format-date(${myDateQuestion},'%Y/%m/%d %H:%M') for example. Depending on the format you want to display you can change params and order for the returned date string format.
The updated calculation would be as follows: concat("GO","_", format-date(${DATES},'%Y/%m/%d %H:%M'))
More information about the format-date function can be found here: https://community.esri.com/groups/survey123/blog/2016/04/17/dates-and-time-in-survey123-for-arcgis
Regards,
Phil.
Wow Phil, That was fast and worked a treat! Thanks!!!