ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Join value of column in child table and set value to field in parent document


#1

Child table : SubItems
filed in child table: x

parent table: Item
field in parent table: y

I want to join all value of field “x” in child table and set the result on y field

the script which I tried but didn’t work as the following:

frappe.ui.form.on(“Item”, {
validate: function(frm) {
all = 0;

	$.each(frm.doc.SubItems|| [], function(i, d) {

		var items = (d.x); 
		var all = items.join(); 

	});
	frm.set_value("y", all);
}

});

Please help, thanks