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

Plus Minus Formula?

New Here ,
Mar 10, 2016 Mar 10, 2016

I am currently trying to get 2 of the same fields to look for a discrepancy between the two.

The formula I am using is:

function _Sum() {

var total = 0;

for (var count=0; count<_Sum.arguments.length; count++) {

  if ( _Sum.arguments[count] )

   total += _Sum.arguments[count];

}

return(total);

}

event.value = _Sum(((this.getField("discrepancy")).value*(-1)))

Is there something I am missing. I am also trying to get a field to still be editable and still calculate the numbers. What should I do to get this to work properly?

TOPICS
Acrobat SDK and JavaScript , Windows
578
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
Community Expert ,
Mar 10, 2016 Mar 10, 2016

What's the point of a sum function if you're only providing it with one

parameter?

On Thu, Mar 10, 2016 at 7:20 PM, nathanh91795179 <forums_noreply@adobe.com>

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 ,
Mar 10, 2016 Mar 10, 2016

That is the only parameter I need in this form. The fields I am looking for a discrepancy in are identical fields

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
Community Expert ,
Mar 10, 2016 Mar 10, 2016

I don't follow... If they're identical (with the same name?) how can there be a discrepancy?

If you want this field to just have the same value as the other field, only multiplied by -1, simply use this code:

event.value = Number(this.getField("discrepancy").value) * -1;

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 ,
Mar 10, 2016 Mar 10, 2016

What I have is a text field that needs to equal three different text field subtracted from each other but still have the field to be able to be edited manually.

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
Community Expert ,
Mar 10, 2016 Mar 10, 2016
LATEST

I don't see how your code achieves anything close to that...

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