After creating a custom report template in Survey123 and receiving no syntax errors, I attempt to run a sample report and get this error:
There is no 'value' field in my surveys, and strangely enough, I was able to actually generate a report several times before I began receiving this error. So I know that my templates work correctly. Why this error all of a sudden? Did I run into an issue on the Esri Cloud side?
I've attached the sample report that I got to generate correctly with my custom template, as well as the associated XLSX of the survey.
Hey everyone,
I wanted to share what ended up being the root cause of this error for us because it took a while to track down and I think it'll save someone else a headache. Shout out to everyone for pointing me in the right direction.
We were getting the "Cannot read properties of undefined (reading 'value')" error when generating reports for one specific request type in our survey. What made it confusing was that we have multiple report templates — Facility Maintenance, Internal Maintenance, Event Setup, and General Maintenance — and all of them were generating just fine except Internal Maintenance.
To figure out what was different, I had Claude read both the working and broken templates as raw XML (a .docx file is really just a zip of XML files under the hood). That's when we spotted it.
In the working Facility Maintenance template, the photo syntax looked like this in the XML — fragmented across multiple runs:
[Run 1]: ${#
[Run 2]: photo}$
[Run 3]: {$file |
[Run 4]: size:350:250
[Run 5]: }${/}
But in the broken Internal Maintenance template, the same syntax was sitting in a single run:
[Run 1]: ${#photo}${$file | size:350:250}${/}
Visually in Word they look completely identical. But ESRI's report engine apparently can't handle all three photo tags concatenated in one XML run — it crashes with the "value" error instead of just rendering the image.
The reason they ended up different? The Facility template had the photo tags typed out manually, so Word naturally broke them into multiple runs as I typed (spell check interrupts, cursor movements, etc. all cause Word to start new runs). The Internal template had the same line copied and pasted in, which Word inserts as one clean continuous run.
The fix was straightforward once we knew what to look for — just retype the photo syntax manually in the template instead of pasting it, and it works perfectly.
Hopefully this helps someone. The error message gives you absolutely nothing to go on, so unless you're reading the raw XML you'd never find this. Would be great if ESRI's parser could handle both cases since they're logically identical — but for now, type don't paste when it comes to image tags.
Wow, thanks @RonGarcia - that is incredibly useful to know. Agree that it would be useful if ESRI could update to deal with these situations, and also provide alot more context to the error messages in future to point us to the troublesome lines.