ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

How to fetch data from child table of another doctype


#1

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


#2

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 -%}


#3

Thanks lokesh. It worked.


#4