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

Need to give msgprint for the selected rows


#1

Hi all,
I am having a problem in msgprint i am selecting one row and giving a value above the criteria value then msgprint has to be display for the selected row only but for all rows msgprints are shown in UI
following js code,

value: function(frm,cdt,cdn)
for (var k=0; k<frm.doc.readings.length; k++) {
const originalString = frm.doc.readings[k].acceptance_criteria
const splitString = originalString.split(" ");
if (originalString.indexOf(“Not Less Than”) > -1 && frm.doc.readings[k].idx) {
if(Number(frm.doc.readings[k].value) < Number(splitString[3])
||Number(frm.doc.readings[k].value) == Number(splitString[3])){
frappe.msgprint('Warning: Test Result is below the Acceptance Criteria in '+ 'row ’ +frm.doc.readings[k].idx)
}
}
else if(originalString.indexOf(“Not More Than”) > -1 && frm.doc.readings[k].idx)
if(Number(frm.doc.readings[k].value) > Number(splitString[3])
||Number(frm.doc.readings[k].value) === Number(splitString[3])){
frappe.msgprint('Warning: Test Result is above the Acceptance Criteria in ’ + 'row ’ +frm.doc.readings[k].idx)
}
}
else if(originalString.indexOf(“Outside Range”) > -1 && frm.doc.readings[k].idx) {
if(Number(frm.doc.readings[k].value) >= Number(splitString[2])
&& Number(frm.doc.readings[k].value) <= Number(splitString[4])){
frappe.msgprint('Warning: Test Result is within the Acceptance Criteria in ’ + 'row ’ +frm.doc.readings[k].idx)
}
}
else if(originalString.indexOf(“Within Range”) > -1 && frm.doc.readings[k].idx) {
if(Number(frm.doc.readings[k].value) < Number(splitString[2])
||Number(frm.doc.readings[k].value) > Number(splitString[4])){
frappe.msgprint('Warning: Test Result is outside the Acceptance Criteria in ’ + 'row ’ +frm.doc.readings[k].idx)
}
}
}
}


#2

Hi all, can any one help me to display the msgprint for the selected rows

In above Screenshot “warning msgprints are getting displayed for all the rows” i want to show this msgprint for the selected row… TIA


#3

hii everyone, stucked in this above msgprint…any idea?