Select to view content in your preferred language

Date calculations in survey123 report template

188
3
08-27-2025 08:48 AM
RCAAdmin
New Contributor

Hello,

I am trying to create a report template that has a repeat table I want to pull from. In the repeat table, I only want to show items the are >= today()-5days. How do I write this in an if statement? So far I have tried:

${repeat_name}${if material_date >= today()-5}

And

${if material_date >= dateadd(now(), -5, 'days')}

Any advice would be greatly appreciated!

0 Kudos
3 Replies
Neal_t_k
Frequent Contributor

First your repeat tagging should have a "#" in it and be sure to close it

${#repeat_name}${/}

This documentation has info on working with dates in reports

https://doc.arcgis.com/en/survey123/browser/analyze-results/featurereport-conditionalelements.htm

However, It says that there is no equivalent to now() and today() functions for report syntax.  You could maybe limit to the say 5 most recent entries by ordering by date and returning only the 5 most recent, using "orderByFields" and "resultRecordCount"...

https://doc.arcgis.com/en/survey123/browser/analyze-results/featurereportqueries.htm

 

Also see this if you really want to dig in.

https://community.esri.com/t5/arcgis-survey123-questions/today-in-survey123-feature-reports/td-p/781...

 

BrentBass
New Contributor

Try this:

${repeat_name}.query("material_date >= today() - 5") | format:"json"

0 Kudos
Neal_t_k
Frequent Contributor

@BrentBass Have you successfully implemented this and can you share any documentation for this method?  I couldn't find and documentation and I tried with sample data and couldn't get it to work.  

0 Kudos