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

Javascript for calculation of weighted grades

New Here ,
Jul 21, 2016 Jul 21, 2016

I am working on a form that has calculated 6 seperate domains.  Each domain has a percentage weight that I need to calculate.  It works for me in excel but don't know how to do a javascript for pdf.

  

GradeWeightScore
9110%7.35
6515%11.025
8020%14.7
7325%18.375
6830%22.05
377
75.473.5
AverageWeighted

Here is my formula for the 73.5 weighted calculation=SUMPRODUCT(A3:A7, B3:B7)/SUM(B3:B7)

I tried this script but it doesn't work

=SUMPRODUCT(Rating_Domain_1+Rating_Domain_2+Rating_Domain_3+Rating_Domain_4+Rating_Domain_5+Rating_Domain_6, Score_1+Score_2+Score_3+Score_4+Score_5+Score_6)/SUM((Score_1+Score_2+Score_3+Score_4+Score_5+Score_6)

Where Rating Domain = Grade and Weight = Score

Any help is appreciated.

TOPICS
Acrobat SDK and JavaScript
1.5K
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
LEGEND ,
Jul 21, 2016 Jul 21, 2016

Exactly where did you place this script?

It does not meet the coding requirements for using the Simplified Field Notation and does not use the statements needed by the custom JsvaScript option.

Have opened the Acrobat JavaScript console to see any syntax errors or other run time issues?

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 ,
Jul 21, 2016 Jul 21, 2016

I tried both Simplified Field Notation and Custom but obviously I don't do javascript and hoping that someone could take my excel formula and create the javascript

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
LEGEND ,
Jul 22, 2016 Jul 22, 2016
LATEST

Excel formulas are not JavaScript. Also Acrobat forms use field names and column and row ranges.

Many of the Excel functions do not exist in JavaScript so you either have to create a custom function or write the code to perform the function.

Adobe provides for free the Acrobat JS API Reference and other documentation about Acrobat JavaScript in the.be Acrobat Developer Connection at Adobe.com. The Mozilla Developer Network provides for free the JavaScript Reference. There are also numerous tutorials available through links on this site.

If you were to look at the calculation options and how they work, you would see it is possible to compute all the values you need using the "Field is the ______ of the following fields:". You can sum, multiply, and average which should be all of the operations you need.

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