sample id from calculate broken

574
2
Jump to solution
07-11-2017 09:50 PM
LorettaWinton1
New Contributor III

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

typenamelabelhintconstraintconstraint_messagerequiredrequired_messageappearancedefaultreadonlyrelevantcalculationchoice_filterrepeat_countlabel::language1hint::language1media::audiomedia::imagebody::accuracyThresholdbind::esri:fieldTypebind::esri:fieldLengthbind::esri:fieldAliasbody::esri:inputMask
dateTimeDATESDate and timeyesnow()yes${specimen_collected} = 'yes'
textcalc_sample_idSpecimen label${specimen_collected} = 'yes' concat("GO","_", date(${DATES}))
0 Kudos
1 Solution

Accepted Solutions
PhilipWilson4
New Contributor II

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.

View solution in original post

2 Replies
PhilipWilson4
New Contributor II

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.

LorettaWinton1
New Contributor III

Wow Phil, That was fast and worked a treat! Thanks!!!