Copy link to clipboard
Copied
I have a rule for a product to pass or fail to be used.
The rule is if >30, then the product is failed and if <= 30, the product is passed.
I have the following script that works well.
var pf1 = this.getField("Product").value
if (Number(pf1)<=30){event.value = "Pass";}
if (Number(pf1)>30){event.value = "Fail";}
However, when I leave the cell unfilled, then the default of this product is set as "Pass" and I don't want this. I want the default setting as "" (blank) when the cell does not contain any number.
Anyone can help me with this? Cheers
You can use like this:
var pf1 = Number(this.getField("Product").valueAsString);
if(pf1){
if(pf1<=30)
event.value = "Pass";
else
event.value = "Fail";}
else
event.value = "";
Copy link to clipboard
Copied
You can use like this:
var pf1 = Number(this.getField("Product").valueAsString);
if(pf1){
if(pf1<=30)
event.value = "Pass";
else
event.value = "Fail";}
else
event.value = "";
Copy link to clipboard
Copied
Thanks heaps! This works perfectly.
Can you explain what is the purpose of the first if(pf1){
if(pf1){ if(pf1<=30) event.value = "Pass"; else event.value = "Fail";} else event.value = "";
Copy link to clipboard
Copied
Can the value of the cell be zero?