• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

New Here ,
Jul 23, 2019 Jul 23, 2019

Copy link to clipboard

Copied

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};

TOPICS
Acrobat SDK and JavaScript , Windows

Views

617

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 23, 2019 Jul 23, 2019

Remove the ; after }

Votes

Translate

Translate
LEGEND ,
Jul 23, 2019 Jul 23, 2019

Copy link to clipboard

Copied

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

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

JavaScript Comparison and Logical Operators

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 23, 2019 Jul 23, 2019

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 23, 2019 Jul 23, 2019

Copy link to clipboard

Copied

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>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 23, 2019 Jul 23, 2019

Copy link to clipboard

Copied

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};

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 23, 2019 Jul 23, 2019

Copy link to clipboard

Copied

LATEST

Remove the ; after }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines