Deleting a child table row

I have two child tables in on docType.
What I wish is to have a trigger that is activated when I want, so I have a check box. When the checkbox is ticked, it triggers my script.
What I want is the script to create a new line in the second child table with data from the first one (easy enough), and remove the row I just selected.
I don’t know how to delete the child table row. What function does this?
For the record: I can’t see an event for the “delete” button that becomes visable after selecting a row.
I do not want to use this button, but to be able to delete the row once the checkbox is active.
I tried doing this (in system console):

ff = frappe.db.sql("SELECT name FROM tablist_chld WHERE product='dsfgethdfymghm';")[0][0]
chld_doc = frappe.get_doc('list_chld', ff)

but the dsfgethdfymghm row is still there.

Hi @abrefael

Use this code if you want to clear the child table. I hope it will help you


frm.set_value('child_table', []);


doc.child_table = []

Thank You! :wink:


I don’t want to clear the child table, only to delete a specific row.

Hi @abrefael
please read this post

Thank You!

1 Like

Thank you!
Basically, what I was missing was: