Update field of child Table from self child table field


i have doctype name “test001” with submited doctype. and i create child table name “table” insight. child table has 3 field (a, b, sum) . i want use client script to validate when type in field “a” and “b” will auto caculate and write in field “sum” in child table

frappe.ui.form.on('test001', {
    validate: function(frm, cdt, cdn) {
       volume_calc(frm, cdt, cdn)
    }
});

function volume_calc(frm, cdt, cdn){
    var d = locals[cdt][cdn];
    if(d.a != null && d.b != null){
        frappe.model.set_value(cdt, cdn, "sum", (d.a+d.b));
    }
    cur_frm.refresh_field("sum");
}

Please check the reference:

@NCP

Thank you, I did it, but can you give me a link or keyword to the document about this part, I can’t find it on the official document

Learn it.

Reference:

TKS you