Displaying multiple images from repeat: Issues with code and appearances

265
2
03-01-2021 11:40 AM
Phein62
New Contributor

I am creating a Template for a Feature Report in Survey123.

The Survey has a Repeat section that includes images, drawings, and maps.  [The Survey contain 5 other repeats, 8 other possible images per record.]

I used the following string in a row in a table to display the images, if any:

   ${#ECMPics} ${if IMG | getValue:”name”} ${IMG | resultRecordCount:1 | getValue:”” | size:0:150} ${/}${/}

[NOTE:  I was trying to just get the first image, but that isn't working, but it doesn't appear to be hurting, either.]

The row is one cell, and has no other information in it.  In a Template I edited down to just work on images, including those in the Repeat, it displays the images, if any, in a nice horizontal row.   I cut-and-pasted that string back into a blank row in the original Template, and I get error messages.   The one I can address, and that I can only get if I generate a sample report for only one record, says

An error occurred when rendering by the report engine. ${IMG | resultRecordCount:1 | getValue:”” | size:0:150} cannot be rendered, please try to put it in a new line.

If I put a return in like this, still in the same cell:

 ${#ECMPics}

${if IMG | getValue:”name”} ${IMG | resultRecordCount:1 | getValue:”” | size:0:150} ${/}${/}

 

It will display the same images but now vertically, stacked one atop the other, which is not desired.  I've tried splitting the row into three cells, with the ${#ECMPics} tag in the first cell, and everything but the closing tags in the middle cell, and it displays, but again vertically, not horizontally.

[NOTE:  The other error messages seem to be transient, and tell me that the loop with "" is unopened or unclosed.]

The Master Template works fine otherwise without this image row, including displaying data from other repeats, which may include images.  However, the sponsor is insistent on having the opening images be at the top of the Report.

Any help appreciated.

0 Kudos
2 Replies
Phein62
New Contributor

I took the Template apart, and reconstructed it by adding one row at a time from the Master Template table to the images table, and it now works.   I'm not sure what changed, which is problematic, but it works as the sponsor requests, which is not.

0 Kudos
SaraMiller
New Contributor III

I'm getting the same error for one of my reports now.  Is the code you used any different in your rebuilt report than it was when it broke?  If so, what does the before/after look like?

0 Kudos