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

How to resolve Syntax Error identifier starts immediately after numeric literal

Engaged ,
May 11, 2022 May 11, 2022

Copy link to clipboard

Copied

Can anyone tell me why JobStep works but JobType doesn't, and what do I need to do to make it work?  I'm getting a Syntax Error identifier starts immediately after numeric literal.  Thanks!

var a = 0;
for(var i=1; i<=80; i++){
if(this.getField("ActingRate"+i).valueAsString == "1060 Foreman 1")a = 0611;
else if(this.getField("ActingRate"+i).valueAsString == "1031 Foreman 2")a = 0311;
else if(this.getField("ActingRate"+i).valueAsString == "1054 Subforeman")a = 0540;
else if(this.getField("ActingRate"+i).valueAsString == "1011 Equipment Operator 1")a = 0110;
else if(this.getField("ActingRate"+i).valueAsString == "1015 Equipment Operator 4A")a = 0150;
else if(this.getField("ActingRate"+i).valueAsString == "1021 Truck Driver 1")a = 0210;
else if(this.getField("ActingRate"+i).valueAsString == "1022 Truck Driver 2")a = 0220;
else if(this.getField("ActingRate"+i).valueAsString == "1023 Truck Driver 3")a = 0230;
else if(this.getField("ActingRate"+i).valueAsString == "1039 Lead Hand Asphalt")a = 1039;
else if(this.getField("ActingRate"+i).valueAsString == "1050 Foreman Road Maint & Paving")a = 0511;
else if(this.getField("ActingRate"+i).valueAsString == "1047 Rough Carpenter")a = 0470;
else if(this.getField("ActingRate"+i).valueAsString == "1013 Sweeper Operator")a = 0130;
else if(this.getField("ActingRate"+i).valueAsString == "1005 Painter Tradesman 1")a = 0050;
else if(this.getField("ActingRate"+i).valueAsString == "Admin Tech 1")a = 2301;
if(this.getField("ActingRate"+i).valueAsString != " ")
this.getField("JobStep"+i).value = a;
else
this.getField("JobStep"+i).value = "";}


var a = 0;
for(var i=1; i<=80; i++){
if(this.getField("ActingRate"+i).valueAsString == "1060 Foreman 1")a = 074D0;
else if(this.getField("ActingRate"+i).valueAsString == "1031 Foreman 2")a = 078DO;
else if(this.getField("ActingRate"+i).valueAsString == "1054 Subforeman")a = 071DO;
else if(this.getField("ActingRate"+i).valueAsString == "1011 Equipment Operator 1")a = 020DO;
else if(this.getField("ActingRate"+i).valueAsString == "1015 Equipment Operator 4A")a = 024DO;
else if(this.getField("ActingRate"+i).valueAsString == "1021 Truck Driver 1")a = 037DO;
else if(this.getField("ActingRate"+i).valueAsString == "1022 Truck Driver 2")a = 038DO;
else if(this.getField("ActingRate"+i).valueAsString == "1023 Truck Driver 3")a = 039DO;
else if(this.getField("ActingRate"+i).valueAsString == "1039 Lead Hand Asphalt")a = 390DO;
else if(this.getField("ActingRate"+i).valueAsString == "1050 Foreman Road Maint & Paving")a = 076DO;
else if(this.getField("ActingRate"+i).valueAsString == "1047 Rough Carpenter")a = 012DO;
else if(this.getField("ActingRate"+i).valueAsString == "1013 Sweeper Operator")a = 022DO;
else if(this.getField("ActingRate"+i).valueAsString == "1005 Painter Tradesman 1")a = 058DO;
else if(this.getField("ActingRate"+i).valueAsString == "Admin Tech 1")a = 270DI;
if(this.getField("ActingRate"+i).valueAsString != " ")
this.getField("JobType"+i).value = a;
else
this.getField("JobType"+i).value = "";}

TOPICS
How to , JavaScript , PDF forms

Views

1.0K

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 , May 11, 2022 May 11, 2022

E.g. this is not possible:

  a = 074D0

Use a string:

  a = "074D0"

Votes

Translate

Translate
Community Expert ,
May 11, 2022 May 11, 2022

Copy link to clipboard

Copied

E.g. this is not possible:

  a = 074D0

Use a string:

  a = "074D0"

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
Engaged ,
May 11, 2022 May 11, 2022

Copy link to clipboard

Copied

That fixed it!  Thank you!!

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 ,
May 12, 2022 May 12, 2022

Copy link to clipboard

Copied

LATEST

Read this article on debugging your script:

https://acrobatusers.com/tutorials/why-doesnt-my-script-work/

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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