I'm trying to print a list of attachments in my PDF template. The template is for the entity "Evidence Item" which has "Evidence" as its parent. Both entities have multiple attachments for photographs and log files.
I can print the attachments for the Evidence Item attachment-multiple fields using the code below.
<tr>
<td colspan="4" align="center"><span style="font-size: 12px;">
{{#if photographs}}
{{#each photographs}}{{this.name}}<br>{{/each}}
{{else}}<center><i>None.</i></center>{{/if}}
</span></td>
<td colspan="4" align="center"><span style="font-size: 12px;">
{{#if logFiles}}
{{#each logFiles}}{{this.name}}<br>{{/each}}
{{else}}<center><i>None.</i></center>{{/if}}
</span></td>
</tr>
However, when I want to print the entries in the same fields stored in the parent "Evidence" entity using the code below, I get "None" even when there are files located in those records.
<tr>
<td colspan="4" align="center"><span style="font-size: 12px;">
{{#if evidence.attachments}}
{{#each evidence.attachments}}{{this.name}}<br>{{/each}}
{{else}}<center><i>None.</i></center>{{/if}}
</span></td>
<td colspan="4" align="center"><span style="font-size: 12px;">
{{#if evidence.miscellaneousFiles}}
{{#each evidence.miscellaneousFiles}}{{this.name}}<br>{{/each}}
{{else}}<center><i>None.</i></center>{{/if}}
</span></td>
</tr>
I am using the Dompdf engine.
Thanks in advance!
I can print the attachments for the Evidence Item attachment-multiple fields using the code below.
<tr>
<td colspan="4" align="center"><span style="font-size: 12px;">
{{#if photographs}}
{{#each photographs}}{{this.name}}<br>{{/each}}
{{else}}<center><i>None.</i></center>{{/if}}
</span></td>
<td colspan="4" align="center"><span style="font-size: 12px;">
{{#if logFiles}}
{{#each logFiles}}{{this.name}}<br>{{/each}}
{{else}}<center><i>None.</i></center>{{/if}}
</span></td>
</tr>
However, when I want to print the entries in the same fields stored in the parent "Evidence" entity using the code below, I get "None" even when there are files located in those records.
<tr>
<td colspan="4" align="center"><span style="font-size: 12px;">
{{#if evidence.attachments}}
{{#each evidence.attachments}}{{this.name}}<br>{{/each}}
{{else}}<center><i>None.</i></center>{{/if}}
</span></td>
<td colspan="4" align="center"><span style="font-size: 12px;">
{{#if evidence.miscellaneousFiles}}
{{#each evidence.miscellaneousFiles}}{{this.name}}<br>{{/each}}
{{else}}<center><i>None.</i></center>{{/if}}
</span></td>
</tr>
I am using the Dompdf engine.
Thanks in advance!
Comment