Child Table Row Delete

Hi, if a student is linked with a student group and then the student gets disabled how can we remove it from the student group child table while using a script?

You can use the delete() method on the row if that is what you’re looking for.

1 Like

You can use doc.remove() for removing child row.

Ref:

doc = frappe.get_doc("doctype", "docname")
for row in doc.child_table:
    if condition:
        doc.remove(row)
doc.save()
2 Likes

Update this line?

doc.remove(row)
1 Like

I missed that,
Thanks for correction

Thanks bro.

I cannot find doc.remove() in the Document API, is it missing in the documentation?

this is for clinet sciprt not server script

doc.remove(row) is used on the server side to delete a row from a child table inside a parent document. You just pass the child row you want to remove, and it will take it out of the parent’s list and re-order the remaining rows properly.

2 Likes