Select to view content in your preferred language

Error when generating feature reports: Cannot read property 'value' of undefined.

3730
9
03-04-2020 01:03 PM
KonradHughes
Emerging Contributor

After creating a custom report template in Survey123 and receiving no syntax errors, I attempt to run a sample report and get this error:

Error occurred when rendering by the report engine. Cannot read property 'value' of undefined

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.

Tags (1)
0 Kudos
9 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Konrad,


Apologies for the delay.  This might be better diagnosed via Esri Support - aside from the form, there may also be something about the features or feature service as well.

0 Kudos
MattCreaney
Frequent Contributor

Hi.  I'm having this same issue with one of my templates.  There is no field called 'value', in fact the word does not exist on the report template at all.  I'm confident there is no issue with the template and this survey has a dozen or more similar templates associated with it that work correctly.  Syntax is fine on upload.

Konrad Hughes‌ did you get anywhere with this?

0 Kudos
MattCreaney
Frequent Contributor

Make that 2 templates, the second of which worked correctly the first instance it was used...

0 Kudos
EdmundHall
Occasional Contributor

Hey Matt Creaney‌,

I had a similar issue, and after receiving support from Esri Inc, it turns out the issue with my report template was that I had multiple image references on a single line. Separating them onto dedicated lines fixed the issue with that report template. 

Unfortunately I now have another report template which was working fine previously, and as far as I can see it's not the same issue as I've checked all images within the template, so I'm uncertain the above will help, but it is worth checking.

It is a little frustrating that the report templates will be parsed correctly when uploaded, but these issues still appear to be a syntax issue. This is compounded by the fact the error response given by the Survey123 website has no useful information to troubleshoot the cause of the error.

MattCreaney
Frequent Contributor

Hi @Edmund_Hall

Yes, with this particular issue it turns out that I had multiple image references on a single line.  I agree that the parser should detect this issue really and it should have been documented and easy to find.

Other issues I've had are the "" and “” together in the same template causes the same error.  Perhaps try this?

EdmundHall
Occasional Contributor

Matt Creaney

Thanks for your suggestion - that was exactly what was causing the issue. Hopefully other people find this post too!

 

Regards,

Ed

0 Kudos
ChaselWood
Emerging Contributor

I have experienced this as well. For me it originally seemed like an error with using a code that involved get value, but may not have actual data in the form..... Once I fixed that I still got the error message and simply saved a copy of my template (and added a"USE" at the end as is our standard) and it worked perfectly without any other manipulation. Hopefully this helps if anybody runs into it without having the picture portion in the template. 

0 Kudos
BNix_TPA
Emerging Contributor

Hi, I just came across the same issue and didn't have any photos on the same line.  My issue came down to the images being too large. I changed the file size from ${$file | size:400:0} ... ${/} to ${$file | size:100:0} ... ${/} and that seemed to do it.  Hopefully this can help someone else.

0 Kudos
Martin-E1
Emerging Contributor

I've had this same issue recently and adding this comment as it may help someone else.  I've spent hours and hours trying to troubleshoot this error in a report that has worked 100's of times, but now fails.  In the end it came down to 2 things:

1) A ${if question} statement inside a table, but the close tag ${/} was inadvertently situatated outside of the table.  

2)  My image questions were multiline, allowing for multiple images.  In the report I had the question inside an if statement, to only take up report space if they existed so the code was:

${if H3_image}${#H3_image} ${$file | size:0:0:300:300} ${/}

The solution came down to needing a new line for the repeat image question, after the if statement:

${if H3_image}

${#H3_image} ${$file | size:0:0:300:300} ${/}

 

Once I changed all of these, the report worked once again.  

Until the next time that is.......strongly agree with all contributors.  The tedious process of trial and error uploading reports and running samples to find the issue and the useless information provided in the error message from the Survey123 site, is extremely frustrating.  A better way in future would be great!

0 Kudos