Today() in Survey123 feature reports

1975
4
Jump to solution
10-06-2020 02:31 PM
AntonioDe_La_Rosa1
New Contributor II

How would I add a today() date function into a Survey123 Feature Report Template (.docx).

The template is an organization's letter template and the today() date function would populate the letter's date heading.

Also is there a way to add 'x' amount of days to today's date? I would also like to auto-populate a due date which would be 'x' amount of days from today().

The due date is not a field and only exists as a custom expression in a web map popup for map symbology. 

 Thanks!

0 Kudos
1 Solution

Accepted Solutions
Jim-Moore
Esri Regular Contributor

Hi Antonio

Microsoft Word has a built-in function for inserting dates and times. Please refer to the Microsoft help for more info: Insert today's date in a Word document - Word.

Regarding adding days to today's date, this could perhaps be achieved in Word using a VBA macro or similar, but I have not tried it. Alternatively, you could use a calculation in XLSForm; in your case, would it be practical to calculate the due date in the survey itself? You could store this in a hidden field if necessary, so it doesn't show in the survey form but can be displayed in the report.

More on date/time calculations can be found here Decimal date time—ArcGIS Survey123 | Documentation. The Dates and Times sample in Survey123 Connect also has some good examples.

Best,

Jim

View solution in original post

4 Replies
Jim-Moore
Esri Regular Contributor

Hi Antonio

Microsoft Word has a built-in function for inserting dates and times. Please refer to the Microsoft help for more info: Insert today's date in a Word document - Word.

Regarding adding days to today's date, this could perhaps be achieved in Word using a VBA macro or similar, but I have not tried it. Alternatively, you could use a calculation in XLSForm; in your case, would it be practical to calculate the due date in the survey itself? You could store this in a hidden field if necessary, so it doesn't show in the survey form but can be displayed in the report.

More on date/time calculations can be found here Decimal date time—ArcGIS Survey123 | Documentation. The Dates and Times sample in Survey123 Connect also has some good examples.

Best,

Jim

AntonioDe_La_Rosa1
New Contributor II

Thanks for the reply, this answered my question

colelwhite
New Contributor II

In case this helps anyone else: I found this thread when I was having a similar issue to Antonio's - I needed to summarize survey records edited within the last 30 days in my report.

My solution was to create the Word report template using Python and the python-docx library, which allowed me to include the logic to subtract 30 days from the current date. I then used the ArcGIS Python API to upload the template and generate the report. Next, I'm going to use Windows Task Scheduler to run this script once every 30 days so my organization's admin team can get automatic, scheduled reporting.

 

0 Kudos
MichelleWilliamsERM
Occasional Contributor III

@colelwhite Are you willing to share your Python script? I'd love to do this for my client. 

Thanks for sharing.

0 Kudos