Repair calculations from a pdf interactive form

New Here ,
Sep 21, 2018 Sep 21, 2018

Copy link to clipboard

Copied

Hello! I have a pdf calculations form, based on a previous calculation table designed in Excel. Presently, the Excel file was changed by its author in an interactive pdf one, with formulas transposed in the Javascript language. The trouble is that  the calculations done automatically in the pdf form (basic on the same inputs) generate some differences in the final results, comparing with the similar ones calculated in the Excel one. They are given in the pdf because keeping only the integers, rounding the medium / final values etc, based on the Javascript formulas. My question is whether /  how could I solve this trouble, considering that the calculations from my excel workfile are quite complex and the reference values may not be changed. Thank you! Vladimir A.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

100

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
community guidelines
Adobe Community Professional ,
Sep 21, 2018 Sep 21, 2018

Copy link to clipboard

Copied

It would help if you could post the formula that you use in Excel and the corresponding JavaScript in the PDF form. It could be the JavaScript could be improved/corrected.

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
community guidelines
LEGEND ,
Sep 23, 2018 Sep 23, 2018

Copy link to clipboard

Copied

LATEST

Not all functions in Excel have a corresponding JavaScript method, but it is highly possible that the Excel function can be rewritten as function in Acrobat JavaScript and that function can be included with the form so anyone using the form with Acrobat Reader or Acrobat would have access the calculation without any other action like installing additional code.

Rounding can be controlled. Acrobat forms and one is able to separate the field value from the field's displayed value. One can see this by creating the calculation in more than one field, and then setting the format of one of the fields to "None" and observe the differences. One could even add a third field and use the "util.printf" method to force the value of a field to a rounded value. This approach does not use the default and simple calculation methods but requires the use of custom calculations and custom formatting to control the actual field value and the displayed values.

Acrobat and JavaScript provides several options for "rounding". There is JavaScripts Math.ceil and Math.floor methods that can either truncate a value to the next higher integer or to the closest lower integer. Also one could write a custom function to perform some other complex rounding.

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
community guidelines