Skip to main content
Participating Frequently
May 7, 2021
Answered

The value entered does not match the format of the field.

  • May 7, 2021
  • 1 reply
  • 1682 views

Hi, I keep getting this error whenever the ("A" + i) fields are all blank. Can someone  kindly help me refine the script to ensure that whenever ("A" + i) are all empty, this field should remain blank as well.

Thanks.

var sum = 0;
var sumText = 0; 
for (var i = 1; i < 150; i += 1) {

    if (getField("V" + i).value == "Yes") {sum += 1}
    if (this.getField("A" + i).value != "") {sumText += 1}


event.value = sum/sumText;
}

This topic has been closed for replies.
Correct answer Nesa Nurani

Try like this:

var sum = 0;
var sumText = 0;
for (var i = 1; i < 150; i += 1) {

if (getField("V" + i).value == "Yes") {sum += 1}
if (this.getField("A" + i).value != "") {sumText += 1}

if(sum == 0 || sumText == 0)
event.value = "";
else
event.value = sum/sumText;
}

1 reply

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
May 7, 2021

Try like this:

var sum = 0;
var sumText = 0;
for (var i = 1; i < 150; i += 1) {

if (getField("V" + i).value == "Yes") {sum += 1}
if (this.getField("A" + i).value != "") {sumText += 1}

if(sum == 0 || sumText == 0)
event.value = "";
else
event.value = sum/sumText;
}

OayusufAuthor
Participating Frequently
May 7, 2021

Thank you very much! This worked perfectly!