Using "If" in a child table

I have a Child table call “CONTEOS” in a Doctype call “Mieles Pampero”. In the child table I have a field call “porcentaje” and another call “clasificacion” where I want a Script to put “Polen Dominante” if “porcentaje” > 45%. Somebody can help me? Thanks!

Try Something like this, hope this will help.

frappe.ui.form.on("Child Table Name", {

	refresh: function(frm, cdt, cdn){
		set_per(frm, cdt, cdn);

var set_per = function (frm, cdt, cdn) 
	var child = locals[cdt][cdn];
	if(child.porcentaje > 45)
		frappe.model.set_value(cdt,cdn ,"clasificacion", "Porcentagje is Grater than 45");	
1 Like

Thanks, it works!!