Fetch Child Table Values in Server Script

Let’s assume the use case in which i have a Doctype “Parent” and a child table field called “Childtab”.
Now when i write a script in Parent.py file, i can access the various fields in the doctype as ‘self.field_name’
But how do i fetch the rows in the child table “Childtab” ?
One way i found , while browsing through the forum is to access it like this -
But is there a way to fetch the number of rows in the child table so that i can loop through it?
Any other solution?


1 Like

By using self.get(‘child_table_name’) you have access child table values. Consider following example -

for d in self.get('items'):
   if not d.item_code:
      msgprint(_("Item Code not Found"));

Worked perfectly!
Thank you!