Calculate text value from Date field value

1397
3
Jump to solution
11-18-2016 10:27 AM
JoeFlannery
Occasional Contributor III

I would like to automatically populate a "Season" text field in my bird survey given a DateTime value in the survey.  The “Bird Seasons” that I am using are shown below.  In my survey, I already have a DateTime field.  Can I use a formula or calculation to grab the DateTime value and pick the right Bird Season that corresponds to the date?  Any guidance is much appreciated.

 

Bird Seasons

Winter = Nov. 1 thru Feb. 29

Spring = March 1 thru May 31

Summer = June 1 thru July 31

Fall = Aug. 1 thru Oct. 31

 

 

Thank you,

Joe

0 Kudos
1 Solution

Accepted Solutions
JoeFlannery
Occasional Contributor III

Ismael:

Thank you for your insightful response worked for me!  I'm sure others will find it useful.

We are all new to Survey123 and, I'm guessing, most of us are new to XLSform coding, too. My major takeaway from your response is that Excel formulas can be used in the XLSform that drives Survey123. I am learning a lot by building my first Surveys and I appreciate your Survey123 GeoNet blog posts, Survey123 online help and your personal responses to GeoNet questions. Hats off to you and your great team!

Joe

View solution in original post

3 Replies
IsmaelChivite
Esri Notable Contributor
typenamelabelcalculation
dateaDateDate
calculatemMonthformat-date(${aDate},'%n')
calculatedayDayformat-date(${aDate},'%e')
textseasonSeasonif(${m}>10,'Winter',if(${m}>7,'Fall',if(${m}>5,'Summer',if(${m}>2,'Spring','Winter'))))
NathanEnge
Esri Contributor

Ismael

I am trying to format my date field as: 

format-date(${DATES},'%Y/%n/%e')

but what shows up on the survey is %Y/%n/%e

 

Any clues on how to best format the date as text to show yyyy/mm/dd or better yet yyyy_mm_dd?

0 Kudos
JoeFlannery
Occasional Contributor III

Ismael:

Thank you for your insightful response worked for me!  I'm sure others will find it useful.

We are all new to Survey123 and, I'm guessing, most of us are new to XLSform coding, too. My major takeaway from your response is that Excel formulas can be used in the XLSform that drives Survey123. I am learning a lot by building my first Surveys and I appreciate your Survey123 GeoNet blog posts, Survey123 online help and your personal responses to GeoNet questions. Hats off to you and your great team!

Joe