Select to view content in your preferred language

Custom Survey123 report template fails to generate when geoshape is empty

568
2
04-20-2023 11:30 AM
ColForbin
Occasional Contributor

I have a Survey123 survey built in Connect and published to AGO.  The survey has a geoshape question that is not required.  I have created a custom report template that includes the geoshape answer.  The report fails to generate for survey records with no value for the geoshape with the error:

"An error occurred when rendering by the report engine. Failed to print map for ${submission_polygon}. Connection timed out after 120000ms."

The report generates successfully for survey records that have a geoshape value.

I have tried to add a conditional statement in the report template that would exclude the geoshape answer if it were empty like this:

${if submission_polygon}
${submission_polygon}
${/}

However, this generates the report without the map shown whether there is a geoshape answer or not.

Is there a way to generate the report for both survey records that have a geoshape and do not have a geoshape?

thanks.

0 Kudos
2 Replies
Richard_Purkis
Esri Contributor

Hi @ColForbin 

Thanks for raising the issue.

I do not know the answer to your specific question whether it is possible to  perhaps lop over questions that don't have a geoshape.

When I was working with a customer who was experiencing this issue I explained this is expected behaviour. Geopoints are able to put a 0,0 coordinate on a location if nothing has been selected but the like of geotraces or geoshapes are unable to do this, thus when the question is not completed it throws back the error message you are getting. The workaround was to simply set the question as a required question, ensuring that there is always a geoshape for report submission.

Hope this helps

0 Kudos
ColForbin
Occasional Contributor

Thanks @Richard_Purkis.  I implemented another workaround.  In the survey I added a hidden field called “geoshape_area” which has the calculation:

area(${submission_polygon})

This populates the area of the geoshape into the hidden geoshape_area field. Then in the report template I use this conditional statement:

${if geoshape_area > 0}
${submission_polygon}
${/}

Now the map will show in the report if the geoshape is not null, and it won't display if it is null, and the report generates successfully in both cases.

0 Kudos