Copy link to clipboard
Copied
I am trying to get the following If/Else statement to work and keep getting the "Syntax Error: missing ; before statement 2: at line 3" error.
// Get the value of the input field, as a number
var Overall Performance Rating = this.getField("Overall Performance Rating").valueAsString);
// Set this field's value based on the input value
if (Overall Performance Rating<=1.0) {
event.value = "UnAcceptable";
} else if (Overall Performance Rating>=1.0 && Overall Performance Rating<=1.99) {
event.value = "Needs Major Improvement";
} else if (Overall Performance Rating>=2.0 && Overall Performance Rating<=2.49) {
event.value = "Some Improvement Required" ;
} else if (Overall Performance Rating>=2.50 && Overall Performance Rating<=2.99) {
event.value = "Average" ;
} else if (Overall Performance Rating>=3.0 && Overall Performance Rating<=3.49) {
event.value = "Significant Results";
} else if (Overall Performance Rating>=3.50 && Overall Performance Rating<=3.99) {
event.value = "Exceptional";
} else if (Overall Performance Rating==4.0) {
event.value = "Outstanding";
}
I trying to use the result of the text field labeled "Overall Performance Rating" to dictate the results of the text field this script is being entered in. I am now stuck with the syntax error, what am I missing? Any assistance will be greatly appreciated.
1 Correct answer
Variable names can't have spaces in them.
Copy link to clipboard
Copied
Variable names can't have spaces in them.
Copy link to clipboard
Copied
Do'h! Darn spaces. Thanks, works fine now.

