Highlighted

How to create subtraction calculation function in Acrobat DC?

New Here ,
Jul 29, 2020

Copy link to clipboard

Copied

Hi,

I need to create a function to find the difference between the values of 2 cells in each particular row in my interactive form. 

The names of the two cells are 'From1' and 'To1'.

Under the calculation function, the functions available are only limited to sum, product, average, max, min.

I tried to use the simplified field notation by entering the following statement:

From1 - To1

I achieved no success.

Appreciate if someone can help me on this.

Thank you

TOPICS
PDF forms

Views

40

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

How to create subtraction calculation function in Acrobat DC?

New Here ,
Jul 29, 2020

Copy link to clipboard

Copied

Hi,

I need to create a function to find the difference between the values of 2 cells in each particular row in my interactive form. 

The names of the two cells are 'From1' and 'To1'.

Under the calculation function, the functions available are only limited to sum, product, average, max, min.

I tried to use the simplified field notation by entering the following statement:

From1 - To1

I achieved no success.

Appreciate if someone can help me on this.

Thank you

TOPICS
PDF forms

Views

41

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
Jul 29, 2020 0
Most Valuable Participant ,
Jul 29, 2020

Copy link to clipboard

Copied

That should have worked. You will need to change the value of one of the fields for it to "kick in", though.

If it still doesn't work check the JS Console (Ctrl+J) for error messages.

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...
Jul 29, 2020 0
Engaged ,
Jul 29, 2020

Copy link to clipboard

Copied

If you just want to show difference between 2 fields in 3rd field you can try this as custom calculation script in 3rd field.( rename the names of the fields in code if needed)

var a = this.getField("From1").value;
var b = this.getField("To1").value;
if (a > b || a == b){
this.getField("Difference").value = a-b;
}
if (a < b){
this.getField("Difference").value = b-a;
}

 

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...
Jul 29, 2020 0
Adobe Community Professional ,
Jul 29, 2020

Copy link to clipboard

Copied

1. Be sure that From1 and To1 uses the "Number" format.

 

2. In simplified notation, if ever fields names uses dots or blank spaces they must be escaped with a backslash:

From\.1 - To\ 1

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...
Jul 29, 2020 1