How to fetch data from child table of another doctype

Hello everyone
I want to fetch data in table in my print format from child table of another doctype.
Plz help me.
Thank you.

hii rohan
Try this:
My child table name is bank details which is on doctype company and i am fetching fields like bank address.
Hope this example will help you.
{%- set bank_addresses = frappe.get_list("Bank Details",{"parent": doc.company},"bank_address") -%}
{%- set lst = frappe.get_list("Bank Details",{"parent": doc.company},"name") -%}
{%- for i in lst -%}
<tr>
<td class="bold_text">Bank Address</td>
<td>{{bank_addresses[loop.index-1].bank_address}}</td>
</tr>

{%- endfor -%}

6 Likes

Thanks lokesh. It worked.