Skip to main content
Participating Frequently
July 23, 2019
Answered

SyntaxError: syntax error 6: at line 7 (multiple condition statement)

  • July 23, 2019
  • 1 reply
  • 1241 views

I have a pdf that contains three fields. One is a text field in which dollar amount is entered, the second is a text field in which a term is entered (i.e., 36, 48, 60) and the last field is the one in which the solved amount will be listed. An example of this formula is if Cost of Licenses >$25,000; multiple the entered amount * .03081 if  FinanceTerm = 36.

I'm getting the following error message: SyntaxError: syntax error 6: at line 7. I'm very new to multiple options and can't figure out what I'm missing. Any help is appreciated.

var A = this.getField("CostofLicenses").value; // the value of field A;

var B = this.getField("FinanceTerm").value; // the value of field B;

var C = this.getField("MonthlyPayment").value; // the value of field C;

event.value = "";

if(A>$24,999,B=="36"){event.value=A*.03081};

else if(A<$25,000,B=="36"){event.value=A*.03110};

else if(A>$24,999,B=="48"){event.value=A*.02383};

else if(A<$25,000,B=="48"){event.value=A*.02386};

else if(A>$24,999,B=="60"){event.value=A*.01962};

else if(A<$25,000,B=="60"){event.value=A*.01972};

This topic has been closed for replies.
Correct answer Bernd Alheit

I updated the recommended changes and am now getting a syntax error 6 at line 7

else if(A>24999 && B=="48"){event.value=A*.02383}; - am I missing a space in there?

I appreciate the help.

var A = this.getField("CostofLicenses").value; // the value of field A;

var B = this.getField("FinanceTerm").value; // the value of field B;

var C = this.getField("MonthlyPayment").value; // the value of field C;

event.value = "";

if(A>24999 && B=="36"){event.value=A*.03081};

else if(A<25000 && B=="36"){event.value=A*.03110};

else if(A>24999 && B=="48"){event.value=A*.02383};

else if(A<25000 && B=="48"){event.value=A*.02386};

else if(A>24999 && B=="60"){event.value=A*.01962};

else if(A<25000 && B=="60"){event.value=A*.01972};


Remove the ; after }

1 reply

Legend
July 23, 2019

if(A>$24,999,B=="36")

just isn't right. You use && or || according to the condition you want.

JavaScript Comparison and Logical Operators

try67
Community Expert
Community Expert
July 23, 2019

Also, remove the "$" symbol and the commas from the numbers.

Participating Frequently
July 23, 2019

Thank you. I initially and the && and changed it to a comma after watching a video on line.

Get Outlook for iOS<https://aka.ms/o0ukef>