it this i have calculate tot of criteria and tot of m
arks and display into avrage_marks
see if these help you out. You will have to write custom script to do that:-
One more tip it is highly likely somebody had the same doubt as you so always try searching before posting !
describe in details…
i have create child table average_marks in that i have add 3 columns
1 is number 2. criteria 3. marks
i have fetch this values in parent table supervisor_asse
In parent table i have calculate this tot of criteria and tot _marks
and dispaly in average_mark field in parent doctype
formula is Average mark = (total mark) / (total criteria)
please help and exlain which code in which file i have edit briefly
write you logic for average calculation in parent custom script.
something like below, not tested,
function calculate_avg(){
var child_rows = frm.doc.average_marks;
var total_marks = 0;
var total_criteria = 0;
for(var i in child_rows) {
total_marks += child_rows[i].marks;
total_criteria += child_rows[i].criteria;
}
//calculate average
var avg = total_marks / total_criteria;
frm.doc.average_mark = avg;
frm.refresh_field('average_mark');
}
frappe.ui.form.on("Child Doctype Name", "criteria", function(frm, cdt, cdn) {
calculate_avg(frm);
});
frappe.ui.form.on("Child Doctype Name", "marks", function(frm, cdt, cdn) {
calculate_avg(frm);
});
1 Like
Thanks …
sorry custom script
not report