Custom Calculation Help

Community Beginner ,
Nov 13, 2018

Copy link to clipboard

Copied

I need help converting the following equation (taken from my excel worksheet) to work in my form in Adobe DC:

SUM(D13:D15)/15*C13

Adobe Community Professional
Correct answer by George_Johnson | Adobe Community Professional

It could be something like:

// Get the field values, as numbers

var D13 = +getField("D13").value;

var D14 = +getField("D14").value;

var D15 = +getField("D15").value;

var C13 = +getField("C13").value;

// Perform the calculation and set this value

event.value = (D13 + D14 + D15) / 15 * C13

Replace "D13" etc. in the statements that use getField with the actual field names.

If using the simplified field notation option, it would be:

(D13 + D14 + D15) / 15 * C13

but again you'd use the actual field names. If the field names have spaces, punctuation, or certain other non-alphanumeric characters, you have to escape each such character with a backslash when using this option.

TOPICS
Acrobat SDK and JavaScript

Views

112

Likes

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

Custom Calculation Help

Community Beginner ,
Nov 13, 2018

Copy link to clipboard

Copied

I need help converting the following equation (taken from my excel worksheet) to work in my form in Adobe DC:

SUM(D13:D15)/15*C13

Adobe Community Professional
Correct answer by George_Johnson | Adobe Community Professional

It could be something like:

// Get the field values, as numbers

var D13 = +getField("D13").value;

var D14 = +getField("D14").value;

var D15 = +getField("D15").value;

var C13 = +getField("C13").value;

// Perform the calculation and set this value

event.value = (D13 + D14 + D15) / 15 * C13

Replace "D13" etc. in the statements that use getField with the actual field names.

If using the simplified field notation option, it would be:

(D13 + D14 + D15) / 15 * C13

but again you'd use the actual field names. If the field names have spaces, punctuation, or certain other non-alphanumeric characters, you have to escape each such character with a backslash when using this option.

TOPICS
Acrobat SDK and JavaScript

Views

113

Likes

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
Nov 13, 2018 0
Most Valuable Participant ,
Nov 13, 2018

Copy link to clipboard

Copied

Likes

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
Reply
Loading...
Nov 13, 2018 1
Adobe Community Professional ,
Nov 13, 2018

Copy link to clipboard

Copied

It could be something like:

// Get the field values, as numbers

var D13 = +getField("D13").value;

var D14 = +getField("D14").value;

var D15 = +getField("D15").value;

var C13 = +getField("C13").value;

// Perform the calculation and set this value

event.value = (D13 + D14 + D15) / 15 * C13

Replace "D13" etc. in the statements that use getField with the actual field names.

If using the simplified field notation option, it would be:

(D13 + D14 + D15) / 15 * C13

but again you'd use the actual field names. If the field names have spaces, punctuation, or certain other non-alphanumeric characters, you have to escape each such character with a backslash when using this option.

Likes

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
Reply
Loading...
Nov 13, 2018 1
Community Beginner ,
Nov 14, 2018

Copy link to clipboard

Copied

Thank you so  much! Worked perfectly!

Likes

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
Reply
Loading...
Nov 14, 2018 0