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

Percentage Calculation code not working

New Here ,
Nov 21, 2018 Nov 21, 2018

Copy link to clipboard

Copied

Hello,

I'm trying to create a field that will automatically calculate drug compliance on a clinical trial. The formula is:

(Total dispensed - returned) / (Days between visits x dose[# of pills])

Example:(200-120) / (31 x 3) = 80 / 93 = 0.86 x 100 = 86%

I've used the below code in Adobe Acrobat Pro DC:

event.value=(this.getField("Text45").value-this.getField("Text46").value)/(this.getField("Text60").valueXthis.getField("Text48").value)

It accepts it with out any script error flags but the formula isn't working- its not calculating at all. Where did I go wrong?

Christy

TOPICS
PDF forms

Views

226

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
Community Expert ,
Nov 21, 2018 Nov 21, 2018

Copy link to clipboard

Copied

The multiplication operator in JS is "*", not "X"...

Also, you would need to make sure that the denominator is not zero, or you'll get some strange results, or error messages.

Votes

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
New Here ,
Feb 20, 2021 Feb 20, 2021

Copy link to clipboard

Copied

LATEST

Thank you so much.  I just spent an hour searching on how to fix this issue!

Votes

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