Report Template Summarize repeats on geometry, format stats values, sort rows in repeats

06-15-2022 06:45 PM
Occasional Contributor

So, I’m finally getting the hang of some aspects of generating Survey 123 reports, but there are a couple of items still eluding me. Any help appreciated.

Summarizing repeat areas or lengths based on geometry

If I have a field that I calculate area or length into, I can summarize on that field with a stats function. If I am listing the number of rows in a repeat, I can calculate the area from a getValue function. But I cannot figure out the syntax to summarize the area or length for all repeats based on geometry.

Rounding values or formatting dates derived from the stats function

I’d like help on how to format the output of the stats function to get date formatting and round to a decimal place.

Sorting repeats

If I am generating a listing of all rows in a repeat, how do I control the order in which it is displayed?


Desired output:





Current template:


Revegetation and Monitoring Site Report



Site Features Summary



Total Acres

Planting Units

Get value count: ${Planting_Unit | getValue:"count"}
Stats count: ${Planting_Unit | stats: “count, objectid”}

${Planting_Unit | stats: “sum,Acres_Planting_Unit”}

Invasive Vegetation Units

${Invasive_Vegetation_Unit  | stats: “count, objectid”}

Sum the area in acres based on geometry.

Observation Units

${Observation_Unit | stats: “count, objectid”}

Sum the area in acres based on geometry.


Monitoring Events Summary



Most Recent Event

Planting Unit Monitoring Event

${MonitoringEvent_PlantingUnit | stats: “count, objectid”}

${MonitoringEvent_PlantingUnit | stats: “first, Date_Unit_Monitored_PUME” | orderByFields:"Date_Unit_Monitored_PUME DESC”}

Invasive Veg Monitoring Events

${MonitoringEvent_Invasive_Veg | stats: “count, objectid”}

Show the most recent monitoring event date.


Planting Units

IV Unit ID



${#Planting_Unit} ${Planting_Unit_ID}


${Planting_Unit_polygon | getValue:"area":"acres":"geodesic"} ${/}


Invasive Vegetation Units

IV Unit ID

Cover Ratio



${Invasive_Veg_CoverRatio_IVU_ | getValue:""}

${Invasive_Veg_Unit_polygon | getValue:"area":"acres":"geodesic"} ${/}


Planting Unit Monitoring Event

Planting Unit Monitoring Event ID

Survival Rate



${Survival_Rate_PUME | getValue:""}

${Date_Unit_Monitored_PUME} ${/}





0 Kudos
2 Replies
Occasional Contributor

Well, I got a bit closer today, grokked some of the documentation a little better, but it still feels a bit like throwing spaghetti... I think a clear explanation of the behavior of ${# within and outside of the summary section and in combination with different functions, primarily stats and getValue would be helpful.


${#Planting_Unit | stats: “sum,Acres_Planting_Unit, PU_Acres”}${PU_Acres | round:2} ${/}

in the summary section will sum a numeric field and round to two decimals. I have this placed in a single cell in the above tables.

${#MonitoringEvent_PlantingUnit | stats: “first, Date_Unit_Monitored_PUME, MostRecent_PUME” | orderByFields:"Date_Unit_Monitored_PUME DESC”}${MostRecent_PUME | format:"DD/MM/YYYY”} ${/}

Will give the most recent date formatted as a date placed in a single cell of a table in the summary section.

Still stuck:

${#Invasive_Vegetation_Unit} ${Invasive_Veg_Unit_polygon | getValue: “area”:”acres”:”geodesic”} ${/}

The syntax checker will accept this, but no value is returned. I was hoping for a comma delimited list of the acres of the polygons as a step towards a solution. I'd love the ability to create a variable from the getValue function that could be passed into the stats function, or access to sum(), or something, please. Otherwise, best practice might be to maintain a user-defined acres field and sum on that (as I did in the first row in the original post). As there is no trigger function in table management for auto-populating this on creation of the record, it is less satisfying as the acres field would rely on manual or scheduled updates.

Regress with progress:

${#Planting_Unit | orderByFields: “Planting_Unit_ID ASC”} ${Planting_Unit_ID}

In the first cell of a table will list the rows sorted on Unit id (an alpha id). HOWEVER, the statement 

${Planting_Unit_polygon | getValue:"area":"acres":"geodesic”} ${/}

In the last cell of the row no longer produces the acres value, while it will with an unsorted table--I double checked by removing the sort and the acres appeared again. I would like to be able to sort the table based on one field while still having the getValue function return acres.


TIA for any help. Any thoughts @IsmaelChivite ? @DougBrowning 

Occasional Contributor III

Thanks for brining us for your ride. I was able to fix some of my method formatting thanks to your follow up post. Cheers. 

0 Kudos