Skip to main content
Participant
January 2, 2024
Question

If/then statement to return text score in another field

  • January 2, 2024
  • 1 reply
  • 161 views

I have a Script to Evaluate the numerical score in the field TOTAL and return a Text Score in the field Overall Evaluation Rating but a get a syntext error; missing statement before 1; at line 2

If (TOTAL >= 82) && (TOTAL < 100)) {
event.value = "Superior";
}
else if (TOTAL > 67) && (TOTAL < 81)) {
event.value = "Satisfactory";
}
else if (TOTAL > 60) && (TOTAL < 66)) {
event.value = "Marginal";
}
else if (TOTAL > 0) && (TOTAL < 60)) {
event.value = "Unsatisfactory";
}
...
else {
event.value = "Unsatisfactory!";
}

    This topic has been closed for replies.

    1 reply

    Community Expert
    January 3, 2024

    From pure syntax perspective you have a missing open bracket after all the if, also the first if has a capital I it should be in small caps.

    The correct one would be 

    if ((TOTAL >= 82) && (TOTAL < 100))

    -Manan

    -Manan
    Participant
    January 8, 2024

    Made stntext correction but formula will not calculate. I have set the field calculation order to the check sequence but will not calulate. 

    Community Expert
    January 9, 2024

    Are you scripting this in InCopy or Acrobat?

    -Manan

    -Manan