Skip to main content
logistics227043683
Known Participant
February 19, 2019
Answered

Running loop to make all fields uppercase... getting an error in the console.

  • February 19, 2019
  • 1 reply
  • 481 views

Good evening, I have created a script to spell check a very large list of medications and cancers for our company.

I have created a loop to make all the fields lowercase, before spell checking the document.... However, the fields are being made to lowercase, and then I am prompted the error: 

"InvalidSetError: Set not possible, invalid or unknown.

Field.value:22:Batch undefined:Exec"

Here is my code for the loops:

for (i = 0; i < this.numFields; i++) {

var AllFields = this.getField(this.getNthFieldName(i));

AllFields.value = AllFields.valueAsString.toLowerCase();

}

spell.addWord(items);

spell.check();

for (i = 0; i < this.numFields; i++) {

var AllFields = this.getField(this.getNthFieldName(i));

AllFields.value = AllFields.valueAsString.toUpperCase();

}

Any help would be greatly appreciated!

This topic has been closed for replies.
Correct answer try67

Not all field types have a value property... Specifically, button fields don't have one.

So you need to add a condition in your code that checks the field's type before trying to change its value.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
February 19, 2019

Not all field types have a value property... Specifically, button fields don't have one.

So you need to add a condition in your code that checks the field's type before trying to change its value.