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

Custom Calculation Script Help

New Here ,
Sep 15, 2022 Sep 15, 2022

I am inputting (Name of Field*.20) to get a product and a separate field.  I keep getting syntax errors "SyntaxError: missing ) in parenthetical 1: at line 2

TOPICS
Acrobat SDK and JavaScript
700
Translate
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 ,
Sep 15, 2022 Sep 15, 2022

Please provide specific details on your process.

1) Where is the script being entered? Is it a "Simplified Field Notation" or a "Custom Calculation Script"?

2)  What is the exact script? We can't tell you anything about an error without the exact script.

 

 

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

Translate
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 ,
Sep 15, 2022 Sep 15, 2022

Sorry, I placed it in th Subject.  Its Custom and I listed the script in the question

Translate
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 ,
Sep 15, 2022 Sep 15, 2022

Thom,

I am trying to have the BOM QtyRow1 multiplied by 20% and have the product populate in the Plus Up box.

 

Translate
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 ,
Sep 15, 2022 Sep 15, 2022

That's not how you access a field's value in a script. Use this code:

event.value = Number(this.getField("BOM QtyRow1").valueAsString) * 0.2;

Translate
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 ,
Sep 15, 2022 Sep 15, 2022

That worked!!!  Thank you so much, I am much better at Excel than PDF!  It gave be the correct percentage but I am trying to have it be the total.  Desired qty and plus up.  I am creating this sheet for staff to submit purchases so the more math it can do on it's own the more receptive folks will be.

Translate
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 ,
Sep 15, 2022 Sep 15, 2022

Multiply by 1.2, instead of 0.2, then.

Translate
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 ,
Sep 15, 2022 Sep 15, 2022

And how would I get the plus up X cost to total in the total column.  I really appreciate your help

Translate
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 ,
Sep 15, 2022 Sep 15, 2022
LATEST

Just add that field to the list of fields you're summing up.

Translate
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