Server script for getting child table values

Hi everyone,
Can somebody help me here , i need to get all child table row values using server script .

for mt in frappe.db.get_list(‘Doctype’,filters={‘field’:value}):
if mt:
for mtc in mt.get(“table_name”):
frappe.msgprint(mtc.field)

This is the code i have written , Getting an error saying object not iterable

1 Like

Try This Code


data = frappe.db.get_list(‘Doctype’,filters={‘field’:value})
if data:
	for mtc in data:
		doc = frappe.get_doc("Doctype",mtc['name'])
		for item in doc.get(“table_name”):
			frappe.msgprint(item.field)
3 Likes

@MiM Thank you very much , it is working.

hello,
by using this code I got this error -keyerror
can you please help me in this .