Passing data from Child table to Print format using Jinja

I have a custom Doctype with Print format. I would like to show some data of a Child table in the Print format when this data is present in the Child table. I do not know what the syntax is to refer to Child tables.
How can I achieve this?

if your doctype has child table then you can try this:
For example if your child table name is items which has fields like item_code,item_name etc.
{%- for row in doc.items -%}
<td>{{ row.item_code }}</td>
<td>{{ row.item_description }}</td>
<td>{{ row.item_name }}</td>
{%- endfor -%}


Thank you very much @lokesh, I am already able to show the data I want.

Hello? Is there a way I can do this for the JS Print Format?

yes kraysug. By using below code in your html file,you can do it for the js print format, but you have to render it from your js and pass parameters as data.
{% for(var i=0, l=data.length; i < l; i++) { %}
<td> {%= data[i][__("contact")]%} </td>
<td> {%= data[i][__("name")]%} </td>
<td> {%= data[i][__("phone")]%} </td>
{% } %}

1 Like