Skip to main content
Known Participant
March 12, 2024
Answered

Getting field value 0 if the calue is grater than 0

var J = Number(this.getField("V10").valueAsString);
var K = eval(this.getField("F10").valueAsString);
var d = Number(this.getField("H1").valueAsString);
var e = this.getField("D10").valueAsString;
var f = Number(this.getField("I1").valueAsString);

event.value = "";

if (e !== "") {
e = Number(e);
if (e === 0) {
event.value = "<LOD";
} else {
var total;
if (J !== 0 && f !== 0) {
total = (K * d) / (J * f);
event.value = total.toFixed(3);
}
}
}

Hi, 

in above script when I write 0/100 in K, the value appearing correct in E. But when I write 1/100 is F. Attached pdf link for file. 

Lab. 2.29.24_2 updated.pdf

This topic is closed to new replies. Start a new post to keep the conversation going.
Nesa Nurani
Nesa NuraniCorrect answer
Community Expert
March 14, 2024

I need the cell shows value. Is there any option we can achieve that?


Use another condition:

if (J == 0 && f == 0) {
total = (K * d);  ?

10 replies

try67
Community Expert
Community Expert
March 12, 2024

J7 is zero so the result of this formula is invalid (since division by zero is not allowed):

total = (K * d) / (J * f);

Translate
BhuweshAuthor
Known Participant
March 12, 2024

can you tell me correct script to get the result. 

 

Translate
try67
Community Expert
Community Expert
March 12, 2024

What is the desired result in case J or F are zero?

Translate