How to Subtract two fields to display result

dear team,
I wish to subract two field to get result on available Capacity,
Available Capacity= Capacity - Assigned Capacity,
but still shows no results.



Hi @Mohamed2335,

I think not possible in field level.

If parent doctype and please check the syntax.

frappe.ui.form.on('Your DocType', {
	field_1: function(frm) {
		cal(frm);
	},
	field_2: function(frm) {
		cal(frm);
	},
});

function cal(frm) {
    frm.set_value('total_field', frm.doc.field_1 - frm.doc.field_2);
}

Child Table Calculation for check the below reference:

Thank You!

1 Like

thanks sir, its works