First, you should get the total of each table by adding extra field name total in each table
After that, you can go throw this code to check if this total field is changed and add its value to Total2 Field
frappe.ui.form.on("Doctype Name", "fieldnameoftotal", function (frm, cdt, cdn) {
var total = 0;
$.each(frm.doc.child_table_field_name || [], function (i, d) {
total += flt(d.fieldnameoftotal);
});
frm.set_value("total2", total);
});
I have created a extra field for the Sewing total as TTL1, Labels Total as TTL2 and Trims/accessories total as TTL3
There are many fields in the table, how shall I Include in the script?
These are the field names for Sewing:
Threads
Elastic1
Elastic2
Mobilon Tapes
Piping
Collar
Cuff
Hanger Loops
Others
These are the field names for Label:
Main Label
Care Label
Heatseal
Fit Label
Size Tab
Size Label
Slim Label
Name Label
These are the field names for Trim/Accessories:
Zippers
Black_Gripper
Ziper_Tape
Hood_and_Bar
Buttons_27L_4Hole_1pce_DTM
Buttons_16L_4Hole_8pce_Clear
Rivert
Elets
Belt
Drawcord_Twill_Tape_String
Velour_Tape
Gross_Grain_Tape
Badges
Chain_Guard
Other
I suppose you want to total the threads property from each row in the 3 tables. Is this your entire custom script? also you are setting the value of ttl1, ttl2, ttl3 on change of the threads property, but who is changing the threads prop? It’s visible only in the first table…